Why we cannot use string in mixins?
Rikki Cattermole via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Feb 27 15:59:18 PST 2016
On 28/02/16 12:43 PM, cym13 wrote:
> 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.
I looked it up via Google. You basically said it right.
The user has since been deleted. Every point they made had not only been
debunked but shown to be as useful as this one, the first one.
More information about the Digitalmars-d-learn
mailing list