Design of reflective enums

Michiel nomail at please.com
Sat Feb 24 00:42:29 PST 2007


renoX wrote:

>>>> 2. Built-in enums do not produce symbols in object files. Neither
>>>> should library implementation.
>>> Well for reflective enums, you need to store the strings somewhere..
>>
>> Not if it's a core feature. Every request for a label could be replaced
>> by a literal by the compiler.
> 
> I think that we do not understand, I'm talking about 'reflective enums'
> not regular enums (after all the thread is 'design of reflective enums).
> 
> Reflective are enums where you can print also the *label* associated
> with the enum, so there must be a function somewhere which have these
> label strings to be able to print the label at runtime.
> So the label strings must be of course stored in the binary for
> reflective enums.

Yes, but it wouldn't be a symbol. Like I said, a request for a label
could be replaced by a string literal by the compiler IF reflective
enums were a core language feature.

-- 
Michiel



More information about the Digitalmars-d mailing list