[Issue 5710] cannot use delegates as parameters to non-global template
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Aug 19 07:03:10 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5710
--- Comment #10 from David Simcha <dsimcha at yahoo.com> 2011-08-19 07:03:02 PDT ---
(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(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);
> }
Sounds great if you can pull it off. I was thinking the same thing, but I'm
not familiar enough with the DMD codebase to know how easy/hard it would be to
implement. This would remove some really silly/annoying limitations from
std.parallelism.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list