On 22/06/2006, at 6:47 AM, [EMAIL PROTECTED] wrote:

How would whatever's calling this callback method know to pass in the magic parameter that gets mapped to 'self'?

Welllllll

If Mars were interested in adding them to the compiler it wouldn't be impossible. It can't be done generically in pure RB.

On the callback side it has to have a unique simple C-callable address.

On the handler side it needs a stored member pointer.

One way is to generate a glue function for each callback, the glue function acting as a closure over the address of the object (as if you hand-coded the callback with the address of the object).


That's the whole point about instance methods, and why Mars said that you couldn't do anything useful with them -- an instance method, in any language, involves passing along some extra information that identifies the instance.

Correct.

There's a very good article on member function pointers which shows a decent use for them as delegates at
http://www.codeproject.com/cpp/FastDelegate.asp
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to