stringof Bug?

Don Clugston dac at nospam.com.au
Fri Oct 19 08:31:53 PDT 2007


Janice Caron wrote:
>> BTW, did you try typeof(T!(1)).stringof ?
> 
> Not at the time, but I have now. Surprisingly, it compiles! (What's
> the type of a type?)
Now that's an interesting question...
I've found that sticking typeof() in these sorts of things sometimes gives you 
useful information.
> 
> It prints "void".
Hmm. 'void' frequently seems to be returned in lieu of a compile error.
typeof(a) is always void when a is an alias.

Something I've noticed is that x.stringof and (x).stringof are completely 
different. So (T!(1)).stringof is something else I'd try.
In some of the early releases, .stringof behaved very differently; it performed 
semantic analysis on the expression, and returned a Lisp-y mass of parentheses.
Did you know that .stringof was originally an Easter egg? (One of many <g>). It 
was documented in the spec, but not listed in the change log. IIRC, Walter said 
that it was too buggy to announce.



More information about the Digitalmars-d mailing list