Is this a bug or expected behavior?

Richard Gaskin ambassador at fourthworld.com
Sun Jun 28 11:59:37 EDT 2015


Mike Bonner wrote:

 > Make a stack, put a button on it.  In the script of the button put
 > "set the width of group 1 of me to random(the width of this card)
 >
 > Apply, and click the button.  The button width changes despite being
 > directed at a group that doesn't exist.
 >
 > Is this expected behavior, or should I report it as a bug?  It
 > behaves the same no matter what figmentary object you reference
 > before "of me". Apparently of me trumps all? Tested in 6.6.2 and 7.0.5

Technically this may be a bug, because the statement can't logically 
resolve (groups can't be members of buttons), so one could argue that it 
should refuse to compile rather than try to guess at what you might have 
meant.

I think what's happening there is that you've found a specific case of 
nested object references that confuses the engine to the point that it 
ignores the part that doesn't make sense ("group 1 of") and just uses 
the part that does ("me").

Moving the script to the card level produces the expected result.

Maybe it's worth filing a bug report on, but maybe that might have 
unanticipated side-effects on other forgiving things the interpreter 
does, so it may be tricky to resolve; I haven't read that part of the 
code base so I can't say.

All I can recommend in the here-and-now is that if you find yourself 
writing object references that you know don't make sense and produce 
unexpected results, don't do that. :)

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list