2001-11-22 Miguel de Icaza <miguel@ximian.com>
[mono.git] / mcs / mcs / TODO
1 BUGS
2 ----
3
4 * Implenment Array Initialization
5
6 * FindMembers
7
8         Move our utility FindMembers from TypeContainer to Decl, because interfaces
9         are also scanned with it.
10
11 * Visibility
12
13         I am not reporting errors on visibility yet.
14
15 * Enumerations
16
17         They currently can not be defined in terms of other enumerations
18         or constants.
19
20 * Known problems:
21
22   Cast expressions
23
24         They should should use:
25
26                 OPEN_PARENS type CLOSE_PARENS
27
28         instead of the current production which is wrong, because it
29         only handles a few cases.
30
31         Complex casts like:
32
33                 Array r = (string []) object
34
35         Wont be parsed.
36   
37 * Interfaces
38
39         For indexers, the output of ix2.cs is different from our
40         compiler and theirs.  They use a DefaultMemberAttribute, which
41         I have yet to figure out:
42
43         .class interface private abstract auto ansi INTERFACE
44         {
45                 .custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) 
46                 = ( 01 00 04 49 74 65 6D 00 00 )                      // ...Item..
47                 ...
48         }
49
50 * Interface indexers
51
52         I have not figured out why the Microsoft version puts an
53         `instance' attribute, and I am not generating this `instance' attribute.
54
55         Explanation: The reason for the `instance' attribute on
56         indexers is that indexers only apply to instances
57
58 * In class.cs: Method.Define
59
60         Need to use FindMembers to lookup the member for reporting
61         whether a new is needed or not.  
62
63 * Foreach on structure returns does not work
64
65         I am generating invalid code instead of calling ldarga for the
66         structure, I am calling ldarg:
67
68         struct X {
69                 public IEnumerator GetEnumerator ();
70         }
71
72         X x;
73
74         foreach (object a in x){
75                 ...
76         }
77
78         I need to get the address of that bad boy
79
80 * Handle destructors specially
81
82         Turn ~X () { a () } into:
83         void Finalize () { try { a (); } finally { base.Finalize (); } }
84
85 * Method Names
86
87         Method names could be; `IFACE.NAME' in the method declaration,
88         stating that they implement a specific interface method.
89
90         We currently fail to parse it.
91
92 * Namespaces
93
94         Apparently:
95
96                 namespace X {
97                 }
98
99                 namespace X {
100                 }
101
102         Is failing to create a single namespace
103
104 * Arrays
105
106         We need to make sure at *compile time* that the arguments in
107         the expression list of an array creation are always positive.
108
109 * Fix access to variables of type ref/out
110
111 * Implement dead code elimination in statement.cs
112
113         It is pretty simple to implement dead code elimination in 
114         if/do/while
115
116 * Implement short circuit evaluation.
117
118         Currently our and/or operations do not implement short circuit
119         evaluation.  
120
121 * Foreach and arrays
122
123         Support foreach (T t in Array)
124
125         And optimize to deal with the array rather than getting the enumerator
126         out of it.
127
128 * Indexer bugs:
129
130         the following wont work:
131
132         x [0] = x [1] = N
133
134         if x has indexers, the value of x [N] set is set to void.  This needs to be
135         fixed.
136
137 * Array declarations
138
139         Multi-dim arrays are declared as [,] instead of [0..,0..]
140
141 * Variables
142
143         Things like:
144
145         for (int i = 0; ...; i++){
146         }
147
148         for (int i = 0; i < 10; i++){
149         }
150
151         Currently defines `i' for the rest of the execution after the first
152         loop, so the second loop generates an error.
153
154         I think we should pop all the blocks until this point.
155
156 PENDING TASKS
157 -------------
158
159         * Implement Using.
160
161         * Implement Goto.
162
163         * Implement Switch.
164
165         * Unsafe code.
166
167 * Using Alias
168
169         Need to reset the aliases for each compilation unit, so an
170         alias defined in a file does not have any effect on another one:
171
172         File.cs
173         =======
174         namespace A {
175                 using X = Blah;
176
177                 class Z : X {           <-- This X is `Blah' 
178         }
179
180         File2.cs
181         namespace {
182                 class Y : X {           <-- This X Is not `Blah' 
183                 }
184         }
185
186         I think we can implement Aliases by having an `Alias' context in all
187         the toplevel TypeContainers of a compilation unit.  The children typecontainers
188         just chain to the parents to resolve the information.
189
190         The driver advances the Alias for each file compiled, so that each file
191         has its own alias set.
192
193 * Handle volatile
194
195 * Support Re-Throw exceptions:
196
197         try {
198                 X ();
199         } catch (SomeException e){
200                 LogIt ();
201                 throw;
202         }
203
204 * Static flow analysis
205
206         Required to warn about reachability of code and definite
207         assignemt as well as missing returns on functions.
208
209
210 OPTIMIZATIONS
211 -------------
212
213 * Emitcontext
214
215         Do we really need to instanciate this variable all the time?
216
217         It could be static for all we care, and just use it for making
218         sure that there are no recursive invocations on it.
219
220 * Static-ization
221
222         Since AppDomain exists, maybe we can get rid of all the stuff
223         that is part of the `compiler instance' and just use globals
224         everywhere.
225
226
227 * Constructors
228
229         Currently it calls the parent constructor before initializing fields.
230         It should do it the other way around.
231
232 * Reducer and -Literal
233
234         Maybe we should never handle -Literal in Unary expressions and let
235         the reducer take care of it always?
236
237 * Use of EmitBranchable
238
239         Currently I use brfalse/brtrue in the code for statements, instead of
240         using the EmitBranchable function that lives in Binary
241
242 * Create an UnimplementedExpcetion
243
244         And use that instead of plain Exceptions to flag compiler errors.
245
246 * ConvertImplicit
247
248         Currently ConvertImplicit will not catch things like:
249
250         - IntLiteral in a float context to generate a -FloatLiteral.
251         Instead it will perform an integer load followed by a conversion.
252
253 * Tests
254
255         Write tests for the various reference conversions.  We have
256         test for all the numeric conversions.
257
258 * Remove the tree dumper
259
260         And make all the stuff which is `public readonly' be private unless
261         required.
262
263 * Optimizations
264
265         In Indexers and Properties, probably support an EmitWithDup
266         That emits the code to call Get and then leaves a this pointer
267         in the stack, so that later a Store can be emitted using that
268         this pointer (consider Property++ or Indexer++)
269
270
271 RECOMMENDATIONS
272 ---------------
273
274 * Use of lexer.Location in the parser
275
276         Currently we do:
277
278         TOKEN nt TERMINAL nt TERMINAL nt3 {
279                 $$ = new Blah ($2, $4, $6, lexer.Location);
280         }
281
282         This is bad, because the lexer.Location is for the last item in `nt3'
283
284         We need to change that to use this pattern:
285
286         TOKEN { $$ = lexer.Location } nt TERMINAL nt TERMINAL nt3 {
287                 $$ = new Blah ($3, $5, $7, (Location) $2);
288         }
289
290         Notice how numbering of the arguments changes, as the { $$ =
291         lexer.Location } takes up a number
292
293 * local_variable_declaration
294
295         Not sure that this grammar is correct, we might have to
296         resolve this during semantic analysis.
297
298