remove experimental code in #if false .. #endif
[mono.git] / mcs / mcs / TODO
1 * Value Parameter
2
3         I believe that `Value Parameter' might have been introduced
4         after C# 1.0, also notice than in the treatment of Value Parameter
5         the parameters are defined in four categories:
6
7         Section 9.3 in the latest spec.
8
9
10 * Review
11 --------
12
13         Reference type equality operators (15.9.6) introduced
14         operator == (C x, C y) where C is a reference type.
15
16         Our compiler used:
17
18         operator == (object a, object b)
19
20         Review our implementation.
21
22 New
23 ---
24
25         It would be nice to optimize the case of:
26
27                 Method (new ValueType ())
28
29         So that no temporary is created, and we only use a newobj call
30         that remains on the stack, as opposed to ldloca, initobj, ldloc
31         call.
32
33 NEW NOTES:
34 ----------
35
36         ImplicitStandardConversionExists and ImplicitStandardConversion
37         should always be the same, but there are a few diverging lines that
38         must be studied:
39
40                         if (expr_type == target_type && !(expr is NullLiteral))
41                                 return expr;
42
43         vs:
44
45                         if (expr_type == target_type)
46                                 return true;
47
48
49 Null Type
50 ---------
51
52         Need to introduce the NullType concept into the compiler, to address a 
53         few small buglets and remove the hardcoded values for NullLiteral.
54
55         NullLiteral will be the only expression that has the NullType as its type.
56
57         This is what must be used to test for Null literals, instead of `is NullLiteral',
58         and this will introduce a couple of fixes to the rules.
59
60         Revert Martin's patch to Conditional expression that worked around this bug:
61
62                 Reference r = xx ? null : null
63
64         The right fix is to introduce NullType
65
66 ****************************************************************************************
67
68 *   The information on the rest of this file is mostly outdated, and its kept here for
69 *   historical reasons
70 *
71 ****************************************************************************************
72  
73 Error Reporting:
74 ----------------
75
76         * Make yyerror show a nice syntax error, instead of the current mess.
77
78 Iterators
79 ---------
80         * Reset should throw not implemented now.
81
82 Optimization ideas
83 ------------------
84
85         Currently when we build a type cache, it contains private members,
86         internal members, and internal protected members;   We should trim
87         these out, as it shows up on the profile.
88
89         We create too many Arraylists;  When we know the size, we should create
90         an array;
91
92         During parsing we use arraylists to accumulate data, like this:
93
94                 thing:
95                 
96                 thing_list
97                         : thing { $$ =new ArrayList (); $$.Add ($1); }
98                         | thing_list thing { ArrayList a = $1; a.Add ($2); $$ = a; }
99
100         We probably could start using "Pairs" there:
101
102                 thing_list
103                         : thing { $$ = new Pair ($1, null); }
104                         | thing_list thing { Pair p = $1; $$ = new Pair ($2, $1); }
105
106
107 EmitContext.ResolveTypeTree
108 ---------------------------
109
110         We should investigate its usage.  The problem is that by default
111         this will be set when calling FindType, that triggers a more expensive
112         lookup.
113
114         I believe we should pass the current EmitContext (which has this turned off
115         by default) to ResolveType/REsolveTypeExpr and then have the routines that
116         need ResolveType to pass null as the emit context.
117
118 DeclareLocal audit
119 ------------------
120
121         DeclareLocal is used in various statements.  The audit should be done
122         in two steps:
123
124                 * Identify all the declare locals.
125
126                 * Identify its uses.
127
128                 * Find if we can make wrapper functions for all of them.
129
130         Then we can move DeclareLocal into a helper class.
131
132         This is required to fix foreach in iterators.
133
134 Large project:
135 --------------
136
137         Drop FindMembers as our API and instead extract all the data
138         out of a type the first time into our own datastructures, and
139         use that to navigate and search the type instead of the
140         callback based FindMembers.     
141
142         Martin has some some of this work with his TypeHandle code
143         that we could use for this.
144
145 Ideas:
146 ------
147
148         Instead of the hack that *knows* about System.Object not having any children classes,
149         we should just make it simple for a probe to know that there is no need for it.
150
151 Dead Code Elimination bugs:
152 ---------------------------
153
154         I should also resolve all the children expressions in Switch, Fixed, Using.
155
156 Major tasks:
157 ------------
158         Properties and 17.6.3: Finish it.
159
160 readonly variables and ref/out
161         
162 BUGS
163 ----
164
165 * Break/Continue statements
166
167         A finally block should reset the InLoop/LoopBegin/LoopEnd, as
168         they are logically outside the scope of the loop.
169
170 * Break/continue part 2.
171
172         They should transfer control to the finally block if inside a try/catch
173         block.
174
175 * Method Registration and error CS111
176
177         The way we use the method registration to signal 111 is wrong.
178         
179         Method registration should only be used to register methodbuilders,
180         we need an alternate method of checking for duplicates.
181
182 *
183 > // CSC sets beforefieldinit
184 > class X {
185 >   // .cctor will be generated by compiler
186 >   public static readonly object O = new System.Object ();
187 >   public static void Main () {}
188 > }
189
190
191 PENDING TASKS
192 -------------
193
194 * Merge test 89 and test-34
195
196 * Code cleanup
197
198         The information when registering a method in InternalParameters
199         is duplicated, you can always get the types from the InternalParameters
200
201 * Emit modreq for volatiles
202
203         Handle modreq from public apis.
204
205 * Merge tree.cs, rootcontext.cs
206
207 OPTIMIZATIONS
208 -------------
209
210 * User Defined Conversions is doing way too many calls to do union sets that are not needed
211
212 * Add test case for destructors
213
214 * Places that use `Ldelema' are basically places where I will be
215   initializing a value type.  I could apply an optimization to 
216   disable the implicit local temporary from being created (by using
217   the method in New).
218
219 * Dropping TypeContainer as an argument to EmitContext
220
221         My theory is that I can get rid of the TypeBuilder completely from
222         the EmitContext, and have typecasts where it is used (from
223         DeclSpace to where it matters).  
224
225         The only pending problem is that the code that implements Aliases
226         is on TypeContainer, and probably should go in DeclSpace.
227
228 * Tests
229
230         Write tests for the various reference conversions.  We have
231         test for all the numeric conversions.
232
233 * Optimizations: variable allocation.
234
235         When local variables of a type are required, we should request
236         the variable and later release it when we are done, so that
237         the same local variable slot can be reused later on.
238
239 * Add a cache for the various GetArrayMethod operations.
240
241 * MakeUnionSet Callers
242
243         If the types are the same, there is no need to compute the unionset,
244         we can just use the list from one of the types.
245
246 * Factor the lookup code for class declarations an interfaces
247   (interface.cs:GetInterfaceByName)
248
249 RECOMMENDATIONS
250 ---------------
251
252 * Use of lexer.Location in the parser
253
254         Currently we do:
255
256         TOKEN nt TERMINAL nt TERMINAL nt3 {
257                 $$ = new Blah ($2, $4, $6, lexer.Location);
258         }
259
260         This is bad, because the lexer.Location is for the last item in `nt3'
261
262         We need to change that to use this pattern:
263
264         TOKEN { oob_stack.Push (lexer.Location) } nt TERMINAL nt TERMINAL nt3 {
265                 $$ = new Blah ($3, $5, $7, (Location) oob_stack.Pop ());
266         }
267
268         Notice how numbering of the arguments changes as the
269         { oob_stack.Push (lexer.Location) } takes a "slot"  in the productions.
270
271