On Jan 17, 10 23:38, retard wrote:
Sun, 17 Jan 2010 10:20:10 -0500, bearophile wrote:
dsimcha:
What would this accomplish? Everyone who's been using D for a while
knows that,
It will help people that aren't using D for a lot of time yet, as I have
said.
If doing this were more verbose, i.e. if I couldn't just write:
immutable y = 2 * x + 1;
I might be less inclined to do this.
Is this too much long?
auto immutable y = 2 * x + 1;
If it's too much long, there are other ways to shorten it (require a
syntax change): var immutable y = 2 * x + 1;
Or:
immutable y := 2 * x + 1;
Nobody has complained the approach Scala has taken:
val a = 1 // immutable value
var b = List(1,2,3) // mutable ref to immutable list
OTOH the ascription in Scala uses a dedicated uniform syntax unlike type
definitions in C-like languages.
On the first glance I don't even know why the 2 statements are
different! Not a good sign [to me] :)