Am I getting this all right?

Sean Kelly sean at f4.ca
Wed Dec 13 22:13:05 PST 2006


Jason House wrote:
> Sean Kelly wrote:
>>
>>> * Enums do not (and can not) have a toString property
>>
>> They don't at the moment.  One could be added, I imagine, but it would 
>> have to be done in the compiler.
> 
> That's exactly correct... Or at the very least the compiler must allow 
> such properties to be added to them.  I did try adding my own toString 
> property (just in case there was neat hidden feature like that)

This actually works for arrays, but only arrays.  People have asked in 
the past that it be extended to work for arbitrary types, but no luck so 
far.  ie.

     void doSomething( char[] buf );

     doSomething( "abc" );
     "abc".doSomething();

Both of the above calls should work, since char[] is an array type.


Sean


More information about the Digitalmars-d-learn mailing list