The stately := operator feature proposal

Paulo Pinto pjmlp at progtools.org
Thu May 30 05:28:28 PDT 2013


Am 30.05.2013 13:41, schrieb MrzlganeE:
> x := 2 / pi*z;
> auto x = 2 / pi*z;
>
> z := column(i, x, diag);
> auto z = column(i, x, diag);
>
> I don't think it's worth it force all people to write the second form,
> over a theoretical nitpick that the programmer will possibly forget how
> interpret symbols.
>
> To me, 'auto' has a price. The price is a foreign word being inserted
> into my math. It's an invasive term. It ruins the beautiful expression.
>
> If you think the programmer is going to forget how to read symbols, you
> should consider both sides: "The programmer might forget how to read
> symbols, but also the programmer will be able to write declarative
> expressions involving just their own terms."
>
> It's not all bad, you see?
>
> I am trying to reach for an expressiveness which allows such a simple
> thing -- writing expressions that involve just my own terms: x. 2. pi.
> z. That's the feature!
>
> And allowing to make expressions with just my own terms is such a small
> change to the language, we are only inches away from that. It drives me
> crazy to be so close.
>
> auto x = 2 / pi*z; is like ketchup in my sushi, every time.
>
> Try to consider that people always oppose every single new thing. They
> would have said the array slices are not C-like enough, and that '..' is
> not in the C language and should not be used. But we have that great
> feature now because somebody decided not to be so conservative.

I disagree.

Given my Pascal background I have a special liking for ":=", and Go also 
makes use of ":=" in the form you propose.

However D's auto follows the way C++11 has decided for type inference 
which is the crowd that we want to bring to D. And not very different 
from var, also used for the same purpose in many other languages.

Additionally, we should avoid making D into a TIMTOWTDI language.

--
Paulo


More information about the Digitalmars-d mailing list