Irv,
You are right - parameters are stack allocations; I've never seen anyone directly have a property as a parameter and pick them up directly. I suppose you could write a compiler to do so - but C and Lingo aren't written that way, afaik. If it does work in Lingo then someone went out of their way to make it so.
- Tab
At 11:26 AM 3/23/04, Irv Kalb wrote:
I just tried it, and I found that version #2 does not compile. I get a "comma expected" within the pCurrent.pModule part of the on mHandler line.
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
[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!]
