https://d.puremagic.com/issues/show_bug.cgi?id=5710
Martin Nowak <c...@dawg.eu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |c...@dawg.eu --- Comment #25 from Martin Nowak <c...@dawg.eu> 2013-11-17 08:51:48 PST --- (In reply to comment #9) > My idea: > doStuff receives a context pointer that points 'an array of context pointers'. > Backend receives code like follows... > > uint doStuff(alias fun)(uint a, uint b, void** this) // not void* this > { > // (*this + 0) points the object Foo > // (*this + 1) points the stack frame of main() > > //return fun(a, b); > return fun(a, b, (*this + 1)); > } > > Caller of doStuff have to create array of context pointers. > > void main(){ > ... > //foo.doStuff!add(1, 2); > void*[2] thisarray = [(stack frame of main), foo]; > doStuff(a, b, thisarray.ptr); > } Good to see, that you already know this solution. I think the biggest hurdle to implement is teaching the IR/backend to get doStuff's this pointer from an array. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------