enum pointers or class references limitation

Q. Schroll via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 1 16:37:33 PDT 2017


On Friday, 1 September 2017 at 23:13:50 UTC, Q. Schroll wrote:
> [..]
> Just as Scott Meyers said: make it easy to use correctly and 
> hard to use incorrectly. Today it's easy to use incorrectly.

While
   enum foo = [1,2,3];
   assert(foo is foo);
fails,
   enum bla = "123";
   assert(foo is foo);
passes.

Enhancement request submitted: 
https://issues.dlang.org/show_bug.cgi?id=17799

Unfortunately after I found out the second one does not have to 
do with mutability. Making foo immutable(int)[] does not change 
anything. It only works for const(char)[], immutable(char)[], and 
probably w/dchar friends. That's odd.


More information about the Digitalmars-d mailing list