lazy redux

Lutger lutger.blijdestijn at gmail.com
Mon Dec 7 16:02:04 PST 2009


retard wrote:
...
> You surely understand that Walter doesn't have enough time to change this
> before the Andrei's book is out. So D2 won't be getting this. Besides, he
> hasn't even said that he likes the syntax. And D can't infer the types
> that way, you would need
> 
>> Foo (  (auto a, auto b) => a + b );

why not ? (a, b) { return a +  b; } already works for template alias 
parameters.
 
> or
> 
>> Foo (  [T,S](T a, S b) => a + b );
> 
>> 
>> // 4. lambda with statement (previous examples were expressions)
>> Array.FindAll (arr, item =>  { return item.Contains ("abc"); } ); //
>> curly braces, semicolon and return are required when statement is used.
>> 
>> D could use:
>> 
>> 1. auto t = new Thread ( { a=42 } );
>> or auto t = new Thread ( () { a=42 } );
>> 
>> 2. array.findAll (arr, (item) { item.contains ("abc") } );
> 
> Andrei invented the string template parameter hack to avoid this. This
> would work too slowly since the dmd backend from the 1960s cannot inline
> anonymous functions. It can only inline named functions.
> 

I don't think inlining is done in the backend. 




More information about the Digitalmars-d mailing list