Safer casts
BCS
ao at pathlink.com
Sat May 10 21:41:07 PDT 2008
Reply to Dee,
> Yigal Chripun Wrote:
>
>> Dee Girl wrote:
>>
>>> I agree! Strings and aliases are much less powerful than delegates
>>> and closures because they are static and can not have state.
>>> But I am confused about something. I compiled this with phobos:
>>> sort!(function bool(int a, int b) { return a > b; })(array);
>>>
>>> There is clear difference in syntax from your examples. But my
>>> question is: what are the differences in semantics? Thank you, Dee
>>> Girl
>>>
>> I'm not sure what exactly are you asking. are you asking what's the
>> difference between a delegate and a function?
>>
> Please let me rephrase. What is the difference between a function
> passed as an alias, and a delegate? You hate one and you like the
> other so the difference must be big. But I do not find it. Thank you,
> Dee Girl
>
a function is just a free function or a static class function or the like.
A delegate is both a function and a context. Generally the context is another
function's scope or an object or struct.
More information about the Digitalmars-d
mailing list