A nice way to step into 2012
    bearophile 
    bearophileHUGS at lycos.com
       
    Wed Dec 28 04:54:06 PST 2011
    
    
  
Timon Gehr: 
> => expr
> 
> should imo be a shorthand for
> 
> () => expr.
> 
> It saves some ((())(()))().
It saves few (), but zero argument lambdas aren't that common in my functional-style code, and I think it decreases syntax uniformity and code readability. So I think it's a bad idea.
On the other hand I think extending the applicability of this syntax to free functions/methods (as in Scala and Ada2012) is a nice idea, to shorten tiny functions/methods, that are common enough:
class C {
     private int x;
     int getX() => x;
}
------------------------
Walter:
>They expect to see it, or else they mark D as "not having lambdas" and "not supporting functional programming".<
To me this sounds like a bit silly argument to base language design on.
In my opinion the most important reason for the introduction of this anonymous function syntax is that it makes D functional-style code (and generally code that uses lot of callbacks) less noisy, so it makes it more easy to write and read.
Bye,
bearophile
    
    
More information about the Digitalmars-d
mailing list