Help me escape optional parens hell

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 24 01:14:31 PDT 2017


ketmar wrote:

> Meta wrote:
>
>> So I have no clue what I'm doing wrong. This is driving me insane.
>
> aaaah. known $#^#$@^@%.
>
> 	enum SymName = (&symbol).stringof[2..$]; // this, instead of 
> symbol.stringof
>
> dirty hack, let's hope that DMD devs won't change `.toString()` output 
> (i.e. first two chars will always be "& ").
>
> besides this, i know no other way to stop compiler from calling the 
> function there.

i hope devs won't break string representation: i bet that there is ALOT of 
code that is using this trick. i myself borrowed it from some other module 
several years ago. and it looks that the module where i found it borrowed 
the trick from some another module. a really long history. ;-)


More information about the Digitalmars-d-learn mailing list