Suggestion: the callingHandler
Dar Scott
dsc at swcp.com
Sat May 31 11:05:01 EDT 2003
On Saturday, May 31, 2003, at 05:49 AM, curry wrote:
> How about a function that returns the name of the handler that called
> the current handler? For example, this would be useful when a handler
> needs to reset each time a different handler calls it, or to keep
> track of different sets of data for each handler that calls it.
Useful, too, (and even more so for me), would be a reference to the
object whose script contains the handler, something in the class of the
target and me.
From your usage interest, this might be more useful to you. Depending
on one's programming style, the same data set might be used by several
handlers in the same object.
My primary interest is in custom callbacks. In the past I have used
fixed handler name callbacks in which the calling object simply
specifies the object that should get the callback, usually with "the
long id of me". Now I also specify the handler. Being able to get
"the long id of calling object" would allow me to make handlers that
work much like many of the "... with message ..." commands. That would
both simplify them and allow those learning them to build on
established concepts.
I currently use a function callback() to create a callback value from a
long id/name and a handler name. I use some helper functions to call
the handler specified by that value (using send in most cases, so
number and array parameters have limitations).
In your case, Curry, you might want to add an (optional?) parameter
that specifies the data set. Add a programming style in that the data
set name is the handler name.
I wonder what value should be returned for Curry's callingHandler if it
is a function or an event or a message.
Dar Scott
More information about the use-livecode
mailing list