Function Literals
Falk Henrich
schreibmalwieder at hammerfort.de
Wed Mar 14 08:08:40 PDT 2007
Daniel Keep wrote:
> All the type inference that D does thus far seems to be "inside-out",
> that is it uses the known type of inner expressions to determine the
> type of the ones they're contained in. Deriving the type of 'c' up
> there would mean the system would have to work backwards; and things
> could get messy :P
I understand.
>
> Secondly, (c) looks like a C-style cast, and D doesn't like C-style
> casts. In fact, last time I checked, it spat the dummy if you use a
> C-style cast.
You are right, I didn't think about casts when making up the example.
> Thirdly, it could be that it's possible, but an awful lot of work, and
> Walter doesn't see that it's worth it. Given that we recently got
> compile-time function evaluation, I'd agree with him :)
As I understand, the concepts of anonymous delegates / functions are special
cases of lambda expressions. Digging through the news archives I get the
impression that D is moving towards general lambdas on a step-by-step
basis. Under this assumption, I came to the question concerning the
automatic type inference.
Anyway, I think D's pragmatic combination of high-level functional features
with performance critical elements is very nice.
Falk
More information about the Digitalmars-d
mailing list