If I think back real hard to my days of writing compilers, I can understand why this would be. Parameters that are declared on a handler line are allocated storage just like temporary variables within a handler - on the system "stack". This way when you leave a handler, all temporary variables and variables implicitly declared in the handler definition can just go away. For example, consider the following:
on mHandler me, paramVar1, paramVar2 temp1 = paramVar1 + 1 temp2 = paramVar2 + 1 ... end
In this code, when execution enters the handler mHandler, storage for paramVar1, paramVar2, temp1, and temp2 are all allocated on the stack. When the handler exits, Lingo just "pops" these four variables off the top off the stack and these variables go away.
Properties of the object are stored in a different place. In fact, they are stored at the address returned in the "return me" line. The object reference itself points to where the property variables are stored.
Therefore, you could not put a property variable in the line that defines a handler. Property variables and temporary variables are stored in different places.
Hope that made sense ... and I hope it is right :)
Irv
At 10:37 AM -0500 3/23/04, Mendelsohn, Michael wrote:
Hi list...
What would be pros and cons of streamlining version #1 into version #2? Currently, version #1 appears in my parent script, where pCurrent is a property of that parent, and is itself a proplist, and the handler is only called once. Just seeking opinions.
Thanks, Michael M.
-- version #1: -----------------------------------
on mHandler(me, whichModule, whichSection, whichTopic) pCurrent.pModule = whichModule pCurrent.pSection = whichSection pCurrent.pTopic = whichTopic -- rest of the code end
-- version #2: -----------------------------------
on mHandler(me, pCurrent.pModule, pCurrent.pSection, pCurrent.pTopic) -- rest of the code end
For example: gObj.mHandler(3,6,8)
--
Multimedia Wrangler.
[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
