Parameters of pending messages -- is 'it' volatile?

Ben Rubinstein benr_mc at cogapp.com
Tue Jun 27 06:38:42 EDT 2006


On 26/6/06 23:16, Erik Hansen wrote:
> one question, is 'it' volatile?
> 
>> get the result -- should be the message id
>> put tMessage into gaMessageID2message[it]
> 
> or:
> put the result into esto
> put tMessage into gaMessageID2message[esto]
> 
> 'it' is more concise, is it really as safe?

Hang on, isn't that discussion going on somewhere else in this forest?

The answer is yes.

'it' is a handy local variable, avaliable for any use, also set by some 
built-in commands, of which "get" is one.  The only ways that 'it' is unsafe 
are if you forget about this, and expect the value to be preserved across one 
of the commands that changes it.  If you're unsure, don't use it; but you can 
always use it in consecutive commands, as above.

You can think of it like lighting cigarettes in the trenchs of World War I: 
the rule was that they could use one match to light two cigarettes, but if 
they used the same match to light a third, they were at risk from a sniper. 
If you set "it" in one statement, and use it in the next statement, that's 
always going to be safe.  By the third statement, you have to consider whether 
the second statement might have changed it.

> thanks for the applicable cognition.
:/

20 years we've had this darn company name, and still the jokes - but not much 
longer.  In a couple of months we're changing it.  You won't have our (old) 
stupid company name to kick around much longer.  Nosirree.

   Ben Rubinstein               |  Email: benr_mc at cogapp.com
   Cognitive Applications Ltd   |  Phone: +44 (0)1273-821600
   http://www.cogapp.com        |  Fax  : +44 (0)1273-728866




More information about the use-livecode mailing list