FYI: writing to and reading from fields much faster than locals, globals or custom properties

Jim Bufalini jim at visitrieve.com
Fri Feb 19 23:52:58 EST 2010


Josh Mellicker wrote:

> Oops.
> 
> I learned coding from an old guy in an alley, that's why. :-)
> 
> When a handler is not event driven, but just looping, monitoring
> something, and keeps calling itself, what is the proper term?

Recursion or recursive. This is the same as a tight loop because the handler
never ends until the recursive calling stops. Hence, without waits *with
messages* you will have a sluggish GUI. Also, you could easily hit the
recursive limit if the condition you are looking for does not occur as you
expect, and your program will crash.

Use instead:

send "<thisHandlerName>" to me in 1 millisecond

This will solve all of your problems of allowing the GUI to be responsive
and avoid hitting the recursion limit.

One thing to be aware of though, in any case, of using *wait... with
messages* or sending in time. The time factor is not absolute. If, for
example, a handler that takes 10 milliseconds to execute is triggered then
there will be 10 milliseconds between executions of your "in-time loops"

Aloha from Hawaii,

Jim Bufalini




More information about the use-livecode mailing list