Add := digraph to D

F i L witte2008 at gmail.com
Fri Jun 22 13:55:20 PDT 2012


On Wednesday, 20 June 2012 at 14:36:48 UTC, ixid wrote:
> Is there any reason not to add this so you can use foo := bar 
> as a shorthand for auto foo = bar?

If the rest of D's syntax where completely different, then I 
would agree with you're purposed syntax here. But as it stands, 
this is completely inconsistent with the rest of D, and for that 
reason alone shouldn't be introduced. All it can add is confusion.

This is one of the many things I really don't like about Go. 
Often in Go you'll get syntax like:

   var x int
   y := 30

which just looks like there's completely different things going 
on between those lines. What would have been much better is to 
simply remove the 'var' keyword altogether:

   x : int
   y := 10

   // synonymous:
   z := 10u
   z : uint = 10



More information about the Digitalmars-d mailing list