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

Reply via email to