getProp puzzle

dfepstein at comcast.net dfepstein at comcast.net
Mon Sep 12 10:38:32 EDT 2016



Thanks to Mike Bonner for his helpful suggestions. Stack A and Stack B are both mainStacks. Further tests seem to confirm this rule: 

  

A setProp or getProp handler in the script of stack A cannot be invoked for a target in Stack B UNLESS we have "started using" stack A (even if Stack A is the frontmost stack). 

  

On first thought this seems a little strange to me. For function or command handlers, we only need to "start using" a stack if we want to call its script's handlers when that stack is not frontmost; and when we "start using" it those handlers are just as accessible as the handlers in the frontmost stack's script. But for getProp and setProp handlers, the script of the frontmost stack and the script of a stack we have started using do not have the same efficacy. 

  

Perhaps the logic is clearer if Stack B has its own getProp myProp handler whose script differs from Stack A's getProp myProp handler.  In that case it probably makes sense for the virtual property of an object in Stack B to follow the getProp rules of its own stack, when called from Stack A (even though a function handler in Stack A that queries properties of Stack B, invoked while Stack A is frontmost, would take priority over a function handler in Stack B). 

  

David Epstein 



More information about the use-livecode mailing list