DMD 2.066 Alpha

bearophile via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Fri Jun 13 14:04:26 PDT 2014


Steven Schveighoffer:

> To that end, I thought we were moving towards a more scalable 
> solution: like !final or final!false or final(false), which 
> could be nice for metaprogramming.

This is a small problem:


void foo(in int x) {
     auto y = x;
     y++; // error
}


The current solution is long, requires a cast and is not fully 
DRY (the 'x' name is repeated twice):

import std.traits;
void foo(in int x) {
     Unqual!(typeof(x)) y = x;
     y++;
}


!const is useful here (I assume !const to be the same as 
!immutable):

void foo(in int x) {
     !const y = x;
     y++;
}

Bye,
bearophile


More information about the Digitalmars-d-announce mailing list