2001-10-31 Ravi Pratap <ravi@ximian.com>
[mono.git] / mcs / mcs / TODO
1 * Optimizations
2
3         Handle if (!x) converting to remove the `!' and instead of using
4         a brfalse use a brtrue to jump to the end.
5
6 * Emitcontext
7
8         Do we really need to instanciate this variable all the time?
9
10         It could be static for all we care, and just use it for making
11         sure that there are no recursive invocations on it.
12
13 * Static-ization
14
15         Since AppDomain exists, maybe we can get rid of all the stuff
16         that is part of the `compiler instance' and just use globals
17         everywhere.
18
19 * FindMembers
20
21         Move our utility FindMembers from TypeContainer to Decl, because interfaces
22         are also scanned with it.
23
24 * Ordering
25
26         Can a constant_expression invoke overloaded operators?
27         Explicit user-defined conversions?
28
29 * Visibility
30
31         I am not reporting errors on visibility yet.
32
33 * Enumerations
34
35         Currently I am not resolving enumerations.
36
37         Either I track them with `RecordEnum' as I do with classes,
38         structs and interfaces or I rewrite the code to visit type
39         containers and `walk' the enums with this process. 
40
41 * Known problems:
42
43   Cast expressions
44
45         They should should use:
46
47                 OPEN_PARENS type CLOSE_PARENS
48
49         instead of the current production which is wrong, because it
50         only handles a few cases.
51
52         Complex casts like:
53
54                 Array r = (string []) object
55
56         Wont be parsed.
57   
58 * Interfaces
59
60         For indexers, the output of ix2.cs is different from our
61         compiler and theirs.  They use a DefaultMemberAttribute, which
62         I have yet to figure out:
63
64         .class interface private abstract auto ansi INTERFACE
65         {
66                 .custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) 
67                 = ( 01 00 04 49 74 65 6D 00 00 )                      // ...Item..
68                 ...
69         }
70
71 * Interface indexers
72
73         I have not figured out why the Microsoft version puts an
74         `instance' attribute, and I am not generating this `instance' attribute.
75
76         Explanation: The reason for the `instance' attribute on
77         indexers is that indexers only apply to instances
78
79 * Constructors
80
81         Currently it calls the parent constructor before initializing fields.
82         It should do it the other way around.
83
84 * Use of EmitBranchable
85
86         Currently I use brfalse/brtrue in the code for statements, instead of
87         using the EmitBranchable function that lives in Binary
88
89 * Create an UnimplementedExpcetion
90
91         And use that instead of plain Exceptions to flag compiler errors.
92
93 * ConvertImplicit
94
95         Currently ConvertImplicit will not catch things like:
96
97         - IntLiteral in a float context to generate a -FloatLiteral.
98         Instead it will perform an integer load followed by a conversion.
99
100 * In class.cs: Method.Define
101
102         Need to use FindMembers to lookup the member for reporting
103         whether a new is needed or not.  
104
105 * virtual-method.cs breaks
106
107         It breaks on the call to: new B ();
108
109         Where B is a class defined in the source code, my guess is that
110         the look for ".ctor" fails
111
112 * Foreach on structure returns does not work
113
114         I am generating invalid code instead of calling ldarga for the
115         structure, I am calling ldarg:
116
117         struct X {
118                 public IEnumerator GetEnumerator ();
119         }
120
121         X x;
122
123         foreach (object a in x){
124                 ...
125         }
126
127         I need to get the address of that bad boy
128
129 * Using Alias
130
131         Need to reset the aliases for each compilation unit, so an
132         alias defined in a file does not have any effect on another one:
133
134         File.cs
135         =======
136         namespace A {
137                 using X = Blah;
138
139                 class Z : X {           <-- This X is `Blah' 
140         }
141
142         File2.cs
143         namespace {
144                 class Y : X {           <-- This X Is not `Blah' 
145                 }
146         }
147
148         I think we can implement Aliases by having an `Alias' context in all
149         the toplevel TypeContainers of a compilation unit.  The children typecontainers
150         just chain to the parents to resolve the information.
151
152         The driver advances the Alias for each file compiled, so that each file
153         has its own alias set.
154
155 * Tests
156
157         Write tests for the various reference conversions.  We have
158         test for all the numeric conversions.
159
160 * Handle destructors specially
161
162         Turn ~X () { a () } into:
163         void Finalize () { try { a (); } finally { base.Finalize (); } }
164
165 * Handle volatile
166
167 * Support Re-Throw exceptions:
168
169         try {
170                 X ();
171         } catch (SomeException e){
172                 LogIt ();
173                 throw;
174         }
175
176 * Remove the tree dumper
177
178         And make all the stuff which is `public readonly' be private unless
179         required.
180
181 * Use of lexer.Location in the parser
182
183         Currently we do:
184
185         TOKEN nt TERMINAL nt TERMINAL nt3 {
186                 $$ = new Blah ($2, $4, $6, lexer.Location);
187         }
188
189         This is bad, because the lexer.Location is for the last item in `nt3'
190
191         We need to change that to use this pattern:
192
193         TOKEN { $$ = lexer.Location } nt TERMINAL nt TERMINAL nt3 {
194                 $$ = new Blah ($3, $5, $7, (Location) $2);
195         }
196
197         Notice how numbering of the arguments changes, as the { $$ =
198         lexer.Location } takes up a number
199
200 * Method Names
201
202         Method names could be; `IFACE.NAME' in the method declaration,
203         stating that they implement a specific interface method.
204
205         We currently fail to parse it.
206
207 * Namespaces
208
209         Apparently:
210
211                 namespace X {
212                 }
213
214                 namespace X {
215                 }
216
217         Is failing to create a single namespace
218
219 * Arrays
220
221         We need to make sure at *compile time* that the arguments in
222         the expression list of an array creation are always positive.