Type.stringof

Michiel nomail at please.com
Thu Feb 22 07:19:14 PST 2007


Max Samukha wrote:

>>>>>>>> The documentation sais that all types should have the property
>>>>>>>> .stringof, but it doesn't seem to work. Has it been renamed? Or doesn't
>>>>>>>> it exist (anymore)?
>>>>>>> In what case does it not work?
>>>>>> Any case. I tried this:
>>>>> That works just fine here, DMD 1.007
>>>> Ah, I have DMD 1.003. Would that make the difference?
>>>>
>>> Seeing as .stringof was added in DMD 1.005, it might. ;-)
>> Strange. It wasn't even so long ago that I downloaded the compiler. Has
>> stringof only existed for a month or so?
> 
> Yes, it has not been announced as part of the language. Walter said it
> was because it didn't work correctly. And it really doesn't, at least
> for enums. For example, this gives int while Test is expected:

Well, it's handy nonetheless. I'm using it in some assert(0) error messages.

Thanks for the help, everyone. I'll update the compiler.

-- 
Michiel



More information about the Digitalmars-d mailing list