Proposal: new variable definition operator

jovo jovo at at.home
Fri Apr 20 10:07:00 PDT 2007


renoX Wrote:
> 
> I've already tried to suggest ':=' for type inference (before the implementation), without much success obviously..

It's so logical next step. It goes sooner or later.
Perhaps Java will bring it into mainstream first.

> Worse, D use 'auto' instead of 'var' like Scala does.

Yes, auto looks arhaick even now. It's so verbose: 
"Type inference goes on!". Who cares. Wrong emphasis.

It is actually needed even without type inference. We need
way to say loudly: "here new variable goes in!" when it can
be mixed with other code. Nothing better then an operator
can do, C proved that.

Interestingly enough, here are Strustrup's words:
"It cannot be overemphasized that assignment and initialization
are different operations" 
(The C++ Programing Language, Special 3rd Edition, page 283)

And it can be introduced without any code breakage.
Just allow for now.

jovo



More information about the Digitalmars-d mailing list