Dynamic closure vs static closure

Yigal Chripun yigal100 at gmail.com
Sat Oct 25 14:08:22 PDT 2008


Jarrett Billingsley wrote:
> On Sat, Oct 25, 2008 at 9:30 AM, Yigal Chripun <yigal100 at gmail.com> wrote:
>> anyway, I think you got my intention by now.
>> I really don't want to have 3 kinds of function types. I think the
>> already existing separation between function pointers and delegates
>> could be handled better by adding an implicit cast.
> 
> It would start to become untenable, but I would imagine closures would
> be implicitly convertible to scope delegates, since in effect they are
> a subtype, and anywhere a scope delegate could be used, a closure
> could be used as well.  Add to that implicit conversion from functions
> to delegates using thunks and bam, you could have a function take one
> type and it could accept all three.

OK, But my question is why do you need that separation in the first
place? to me it seems an unnecessary distinction between scope delegates
and "regular" delegates.
regarding functions and delegates - I must be missing something but why
do you need a thunk? just allocate a delegate, assign its function
pointer to the function and leave the "context" pointer null. isn't that
enough?



More information about the Digitalmars-d mailing list