Behaviors and the message path

Bleiler, Timothy bleiler at buffalo.edu
Fri Dec 9 15:39:45 EST 2016


> On Dec 9, 2016, at 2:44 PM, mwieder <ahsoftware at sonic.net> wrote:
> 
> I think it's wrong to consider behavior scripts as concatenated onto the end
> of a script. If you rather think of the behavior script as a library or
> backscript, then the message path becomes a little clearer.


Thinking of behaviors as a library/backscript or concatenated onto the end of the owner script both end up missing some important characteristics of behaviors. Mark Waddingham in his reply used a different term, which in my head can encompass the full range. Mark said, “... behaviors aren't really objects - they are script extensions (for want of a better term).” 
 

> In your example 2, the message "you are in Script 3" appears because that instance of
> ASharedHandlerName is in the same scope as TestScript, so it gets priority.
> If you then assign the behavior, you still have the same result.

Maybe I didn’t explain what I’m actually doing correctly or we’re just doing something different, but after I assign the behavior I do NOT get the same result. I get a result that I think is consistent with Mark Waddingham’s explanation that the engine treats the “first” object in the behavior chain as the only “real" object and so begins processing any message within the behavior chain at the object that is returned as “Me” in any behavior scripts.


> What happens when you uncomment the pass command is that control then passed
> out of the Button A object into the next item down the message path, which
> will be the behavior object. You should also have (untested because lazy)
> the same result without assigning the behavior: you will get "you are in
> Button A" followed by a "pass" statement that eventually ends up at the card
> script and triggers "you are in Script 3”.

I agree with you on this one and it doesn’t seem to fit with my understanding of Mark Waddingham’s explanation so I posted another question about this specifically. 


Tim Bleiler, Ph.D.
Instructional Designer, HSIT
University at Buffalo


More information about the Use-livecode mailing list