Function pointers/delegates

Don Clugston dac at nospam.com.au
Thu Nov 29 23:27:28 PST 2007


Craig Black wrote:
> "S" <S at s.com> wrote in message news:fin4j6$1hks$1 at digitalmars.com...
>> real function(real x) y = function real(real x) { return sqrt( 1 - x * 
>> x ); };
>>
>> Is it just me or does it seem odd that real and function are swapped on 
>> one side?
>> I can kind of see this if it's for single-pass parsing, but isn't there a 
>> better way?
>>
>> It's not intuitive at all.
> 
> I like the way C# 3.0 does anonymous functions.  I believe the idea comes 
> from Nemerle.  It would be something like:
> 
> real function(real x) y = real <= (real x) { return sqrt(1 - x*x); }; 
> 
> 

I like the way D does anonymous delegates. <g>

real delegate(real x) y = (real x) { return 1 - x * x; };



More information about the Digitalmars-d mailing list