Feedback request: getProp/setProp and lockMessages
ambassador at fourthworld.com
Sat Nov 23 20:17:36 CET 2013
J. Landman Gay wrote:
> That was the first thing I thought of when I read Richard's proposal.
> From the dictionary:
> Caution! If a setProp handler in one object's script sets the custom
> property for a different object, and the first object is in the second
> object's message path, a runaway recursion will result. For example, if
> the following handler is in a card script, and you set the
> "myCustomProperty" of a button on the card, runaway recursion will result:
> setProp myCustomProperty newValue
> set the myCustomProperty of the target to newValue + 1
> -- Because the target is the button, and this handler is in
> -- the card, the above statement sends another setProp trigger
> -- to the button.
> end myCustomProperty
> To avoid this problem, set the lockMessages property to true before
> setting the custom property.
> So we'd either need a special kind of lock just for setprop, which seems
> convoluted to me, or some other solution. Or a huge 60-point warning in
> red text all over the documentation.
Good point, Jacque - thanks for bringing that up.
Since it involves what is really an erroneous circumstance, it would
seem only as serious (and far less frequently encountered) than what
happens when you put an answer dialog in a loop and can only escape by
Maybe the solution for that isn't to continue hampering the usefulness
of getProp/setProp, but something that would address all the many such
issues we encounter with recursive errors at runtime.
One thought that comes to mind might be to somply have Cmd-. work. :)
Right now that doesn't truly exit to top in all cases, and has no effect
with dialogs, which are especially problematic since they have their own
Maybe the dev engine could be enhanced so that as long as the
environment is "development", Cmd-. exits dialogs and any loops and any
recursive stuff and truly brings a complete halt to all execution.
Whether or not this should be extended to include runtime is a more
complex issue, but if Cmd-. worked in LC as it did in HC it would have
saved me many, many hours over the years.
LiveCode training and consulting: http://www.fourthworld.com
Webzine for LiveCode developers: http://www.LiveCodeJournal.com
Follow me on Twitter: http://twitter.com/FourthWorldSys
More information about the use-livecode