https://issues.dlang.org/show_bug.cgi?id=5710

--- Comment #34 from Martin Nowak <c...@dawg.eu> ---
(In reply to Sobirari Muhomori from comment #33)
> A slightly more straightforward solution: the passed context is effectively
> a closure, and it can contain any variables, so let's just pass this pointer
> in the closure context struct. All the rules of closures apply.
> 
> struct main_add_closure_context
> {
>   auto var1;
>   auto var2;
>   Foo foo_this;
>   auto var3;
>   auto var4;
> }
> 
> This context is like any normal closure, the `add` can simply use it. Also
> pass it instead of `this` argument to doStuff(alias fun), which in its turn
> should be taught to get `this` reference from the passed context struct.

Yes, this is similar to comment 31 and it should work using the normal delegate
pointer. It's still challenging to implement all the IR gen for this.

--

Reply via email to