[Mono-devel-list] String constants and localization

Miguel de Icaza miguel at ximian.com
Mon Jul 14 12:30:21 EDT 2003


> I'm not sure what you are meaning with this. But if you mean that you cannot
> remove the enumeration after compiling because somebody might use
> enum.ToString() then you are right.
> However there is no case in which anybody should use ToString on that enum
> anywhere.
> The enum in this case basically serves as an auto-(re)indexing int field

Yes, but this is not something the compiler knows.  

Because you can always do:

	object a = MyEnum.Value;

And later call ToString ()

Even worse: you can do dynamic invocations;  Even worse: the private
types and the private data *have to be* [1] compiled in, even if they are
not exposed to the world (think: debugger).

[1] Well, they dont *have to*, but not doing it means creating a
parallel universe of metadata just to support this.

So the compiler would have to audit all the code before it can know
whether it can remove the enumeration from the output file.  And given
MCS current design, this might not be possible (we create the
enumerations *before* we generate code)


More information about the Mono-devel-list mailing list