Why we cannot use string in mixins?

cym13 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Feb 27 15:43:07 PST 2016


On Saturday, 27 February 2016 at 23:29:49 UTC, mahdi wrote:
> I read this criticism about D on Reddit and it claims that you 
> cannot use strings in mixins. Can you please elaborate about 
> this and the reason behind it?
>
> QUOTE:
> Look at strings: they are defined as immutable(char []). 
> "immutable" as in "you could put it in ROM", ... CTFE can't see 
> strings correctly (can't be determined at compile time). So 
> rather than fix the compiler so that strings can be used in 
> mixins in the way that people expect it to work even if that 
> means making them something other than immutable(char []), they 
> decided to start using enums where strings actually go. 
> Seriously: take the same code and replace 'string "foo"' with 
> 'enum "foo"' and it starts to work!
> END QUOTE

This sounds like (please, pardon my language) a shitty load of 
bullshit from an incompetent that didn't know what he's talking 
about (that's excusable) and didn't try to understand it better 
before going on a pointless rant (that's not).

Could you please provide a link to said comment? Maybe some 
context would help bring some sanity over this statement.


More information about the Digitalmars-d-learn mailing list