[Issue 5710] cannot use delegates as parameters to non-global template

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 10 06:48:57 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5710


Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |k.hara.pg at gmail.com


--- Comment #9 from Kenji Hara <k.hara.pg at gmail.com> 2011-06-10 06:44:19 PDT ---
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);
}

-- 
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