Tidy auto [Was: Re: @disable]
retard
re at tard.com.invalid
Sun Jan 17 07:38:09 PST 2010
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.
More information about the Digitalmars-d
mailing list