D for Suneido

bearophile bearophileHUGS at lycos.com
Sun Aug 12 16:35:38 PDT 2012


Pragma Tix:

> 2) http://thesoftwarelife.blogspot.fr/2012/08/d-tours.html

 From the blog post:

-----------------------

> Another minor annoyance was the lack of an equivalent to Java's 
> static import. If I want to refer to the tokens as just IF or 
> ELSE I could make them "anonymous". But then they don't have a 
> specific type. Or I can give the enum a named type, but then I 
> have to always reference them with Token.IF . In Java I could 
> say import static Token.* and then just use the bare names.<

This helps:

with(Token) {
     // lot and lot of code here
}

---------------------

>One of them being that you can't store immutable objects in a 
>map! Hopefully this is something they'll figure out. I 
>eventually gave up on immutable and managed to get const to 
>work, although even that was a struggle.<

Maybe rebindable helps:


import std.typecons;
immutable class A {
     this() immutable {}
}
void main() {
     Rebindable!(immutable(A))[int] values;
     values[0] = new A;
}


Or maybe he refers to what Object ref was trying to do.

Bye,
bearophile


More information about the Digitalmars-d mailing list