The stately := operator feature proposal
Andrej Mitrovic
andrej.mitrovich at gmail.com
Thu May 30 07:42:49 PDT 2013
On 5/30/13, Russel Winder <russel at winder.org.uk> wrote:
> I still like:
>
> x := 1
>
> for a declaration and initialization with type inference.
Well the saying goes, even a broken clock..
Personally I think it's way too late for such a feature. What if you
make a typo and instead of declaring a new shadowed variable you end
up modifying an existing one?
int x;
void main()
{
auto x = 5; // so far so good, it's obviously a new variable
}
vs:
int x;
void main()
{
x := 5;
}
which with a typo becomes:
int x;
void main()
{
x = 5;
}
Could you easily spot the bug?
More information about the Digitalmars-d
mailing list