The stately := operator feature proposal
Dan Olson
zans.is.for.cans at yahoo.com
Thu May 30 19:47:52 PDT 2013
"Diggory" <diggsey at googlemail.com> writes:
>
> There's another alternative that fits more with D style which is also
> very mathsy.
>
> It would be possible to make storage classes work with the colon
> syntax, ie:
>
> auto:
> x = 1;
> y = 2;
> f = a => a+1
> writeln(f(x) + y);
>
> Also:
>
> immutable:
> x = 3;
> y = 4;
>
> Kind of like option explicit: off in VB
Hmmm, why hasn't anybody just suggested doing this? It seems to work
fine in dmd.
auto
x = 23.5,
y = 14,
z = y*x,
s = "foo",
w = z * s.length;
OR
immutable
x = 23.5,
y = 14,
z = y*x,
s = "foo",
w = z * s.length;
More information about the Digitalmars-d
mailing list