Type.stringof

Max Samukha samukha at voliacable.com
Thu Feb 22 06:04:28 PST 2007


On Thu, 22 Feb 2007 14:33:00 +0100, Michiel <nomail at please.com> wrote:

>Deewiant 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:

enum Test : int
{
	one
}

void main()
{
	pragma (msg, Test.stringof);
}  



More information about the Digitalmars-d mailing list