2001-12-23 Miguel de Icaza <miguel@ximian.com>
[mono.git] / mcs / mcs / TODO
1 Major tasks:
2 ------------
3
4         Apply the method verification process to indexers and properties as well.
5
6         Properties and 17.6.3: Finish it.
7
8         Implement pre-processor.
9
10 BUGS
11 ----
12
13 * Currently the code path for 108/109 reporting is not being ran for methods
14   as we need to compare method signatures.  But since we retrieve the expensive
15   method arguments in the method, we probably should do 108/109 processing there.
16
17 * Emit warning on hiding members without NEW not only in members.
18
19 * Implement visibility.
20  
21 * Adding variables.
22
23         We do add variables in a number of places, and this is erroneous:
24
25         void a (int b)
26         {
27                 int b;
28         }
29
30         Also:
31
32         void a (int b)
33         {
34                 foreach (int b ...)
35                         ;
36         }
37
38 * Visibility
39
40         I am not reporting errors on visibility yet.
41
42 * Interfaces
43
44         For indexers, the output of ix2.cs is different from our
45         compiler and theirs.  They use a DefaultMemberAttribute, which
46         I have yet to figure out:
47
48         .class interface private abstract auto ansi INTERFACE
49         {
50                 .custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) 
51                 = ( 01 00 04 49 74 65 6D 00 00 )                      // ...Item..
52                 ...
53         }
54
55 * Interface indexers
56
57         I have not figured out why the Microsoft version puts an
58         `instance' attribute, and I am not generating this `instance' attribute.
59
60         Explanation: The reason for the `instance' attribute on
61         indexers is that indexers only apply to instances
62
63 * Handle destructors specially
64
65         Turn ~X () { a () } into:
66         void Finalize () { try { a (); } finally { base.Finalize (); } }
67
68         The code is mostly done, but `base' is missing.  The reason it is 
69         missing is because we have to implement visibility first.
70
71 * Method Names
72
73         Method names could be; `IFACE.NAME' in the method declaration,
74         stating that they implement a specific interface method.
75
76         We currently fail to parse it.
77
78 * Arrays
79
80         We need to make sure at *compile time* that the arguments in
81         the expression list of an array creation are always positive.
82
83 * Implement dead code elimination in statement.cs
84
85         It is pretty simple to implement dead code elimination in 
86         if/do/while
87
88 * Indexer bugs:
89
90         the following wont work:
91
92         x [0] = x [1] = N
93
94         if x has indexers, the value of x [N] set is set to void.  This needs to be
95         fixed.
96
97 * Array declarations
98
99         Multi-dim arrays are declared as [,] instead of [0..,0..]
100
101 * Break/Continue statements
102
103         A finally block should reset the InLoop/LoopBegin/LoopEnd, as
104         they are logically outside the scope of the loop.
105
106 * Break/continue part 2.
107
108         They should transfer control to the finally block if inside a try/catch
109         block.
110
111 * Conversions and overflow
112
113         I am not using the checked state while doing type casts,
114         they should result in conv.ovf.XXX
115
116 * Method Registration and error CS111
117
118         The way we use the method registration to signal 111 is wrong.
119         
120         Method registration should only be used to register methodbuilders,
121         we need an alternate method of checking for duplicates.
122
123 * We need to catch:
124
125         extern string Property {
126                 get { } 
127         }
128
129         The get there should only have a semicolon
130         
131 *
132 > // CSC sets beforefieldinit
133 > class X {
134 >   // .cctor will be generated by compiler
135 >   public static readonly object O = new System.Object ();
136 >   public static void Main () {}
137 > }
138
139
140 PENDING TASKS
141 -------------
142
143         * Implement Goto.
144
145         * Unsafe code.
146                 Making the parser accept unsafe code.
147                 
148         * Implement `base' (BaseAccess class)
149
150         * Implement constant folding.  We might need to implement
151           a new `Constant' class and derive Literal from it.
152
153 * OUT Variables passed as OUT variables.
154
155         Currently we pass the pointer to the pointer (see expression.cs:Argument.Emit)
156
157 * Function Declarations
158
159         Support PINvoke/Internallcall and extern declarated-functions.
160
161 * Manual field layout in structures
162
163 * Make the rules for inheritance/overriding apply to 
164   properties, operators and indexers (currently we only do this
165   on methods).
166
167 * Handle volatile
168
169 * Support Re-Throw exceptions:
170
171         try {
172                 X ();
173         } catch (SomeException e){
174                 LogIt ();
175                 throw;
176         }
177
178 * Static flow analysis
179
180         Required to warn about reachability of code and definite
181         assignemt as well as missing returns on functions.
182
183 * Implement `goto case expr'
184
185         switch (x){
186                 case 1: print ("1"); goto case 4;
187                 case 2: ...
188                 case 4: ...
189         }
190
191 * Code cleanup
192
193         The information when registering a method in InternalParameters
194         is duplicated, you can always get the types from the InternalParameters
195
196 OPTIMIZATIONS
197 -------------
198
199 * Emitcontext
200
201         Do we really need to instanciate this variable all the time?
202
203         It could be static for all we care, and just use it for making
204         sure that there are no recursive invocations on it.
205
206 * Static-ization
207
208         Since AppDomain exists, maybe we can get rid of all the stuff
209         that is part of the `compiler instance' and just use globals
210         everywhere.
211
212
213 * Constructors
214
215         Currently it calls the parent constructor before initializing fields.
216         It should do it the other way around.
217
218 * Reducer and -Literal
219
220         Maybe we should never handle -Literal in Unary expressions and let
221         the reducer take care of it always?
222
223 * Use of EmitBranchable
224
225         Currently I use brfalse/brtrue in the code for statements, instead of
226         using the EmitBranchable function that lives in Binary
227
228 * Create an UnimplementedExpcetion
229
230         And use that instead of plain Exceptions to flag compiler errors.
231
232 * ConvertImplicit
233
234         Currently ConvertImplicit will not catch things like:
235
236         - IntLiteral in a float context to generate a -FloatLiteral.
237         Instead it will perform an integer load followed by a conversion.
238
239 * Tests
240
241         Write tests for the various reference conversions.  We have
242         test for all the numeric conversions.
243
244 * Remove the tree dumper, cleanup `public readonly' 
245
246         And make all the stuff which is `public readonly' be private unless
247         required.
248
249 * Optimizations
250
251         In Indexers and Properties, probably support an EmitWithDup
252         That emits the code to call Get and then leaves a this pointer
253         in the stack, so that later a Store can be emitted using that
254         this pointer (consider Property++ or Indexer++)
255
256
257 * Optimizations: variable allocation.
258
259         When local variables of a type are required, we should request
260         the variable and later release it when we are done, so that
261         the same local variable slot can be reused later on.
262
263 * Add a cache for the various GetArrayMethod operations.
264
265 RECOMMENDATIONS
266 ---------------
267
268 * Use of lexer.Location in the parser
269
270         Currently we do:
271
272         TOKEN nt TERMINAL nt TERMINAL nt3 {
273                 $$ = new Blah ($2, $4, $6, lexer.Location);
274         }
275
276         This is bad, because the lexer.Location is for the last item in `nt3'
277
278         We need to change that to use this pattern:
279
280         TOKEN { oob_stack.Push (lexer.Location) } nt TERMINAL nt TERMINAL nt3 {
281                 $$ = new Blah ($3, $5, $7, (Location) oob_stack.Pop ());
282         }
283
284         Notice how numbering of the arguments changes as the
285         { oob_stack.Push (lexer.Location) } takes a "slot"  in the productions.
286
287 * local_variable_declaration
288
289         Not sure that this grammar is correct, we might have to
290         resolve this during semantic analysis.
291
292
293 * Try/Catch
294
295         Investigate what is  the right value to return  from `Emit' in
296         there (ie, for the `all code paths return')
297         
298
299 * Optimizations
300
301         Only create one `This' instance per class, and reuse it.
302
303         Maybe keep a pool of constants/literals (zero, 1)?
304
305
306 ************
307 Potential bug:
308
309         We would need to decode the shortname before we lookup members?
310         
311         Maybe not.
312
313 interface I {
314         void A ();
315 }
316
317 class X : I {
318         void I.A ();
319 }
320
321 class Y : X, I {
322         void I.A () {}
323 }