Comment about "do" (was clickLine/clickcharchunk)
dunbarx at aol.com
dunbarx at aol.com
Tue May 7 20:06:53 EDT 2013
We have been so spoiled that we (I?) mentally parse and evaluate the second line in:
get the clickLine
put random(99) into it
put random(99) into line 3 of fld 4 -- or whatever. Simple, no?
But you know this will not compute.
Danny Goodman once said that he was unsure where the disconnect took place. He just said (paraphrased) "...when it seems like the code ought to work, but doesn't, try a "do" construction..."
He simply meant that sometimes an extra level of evaluation was required for the parser to process the code in the way the user desired. And this is from HC v.1x.
When I first started with LC, one of the first things I tried was to see if something like the first construction above processed "like it should". I think I tested "the foundField". I was astonished that it did not. Is there is something deeply ingrained in the way this type (all types?) of parsers work that it can not do this?
From: J. Landman Gay <jacque at hyperactivesw.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Tue, May 7, 2013 7:29 pm
Subject: Re: Comment about "do" (was clickLine/clickcharchunk)
On 5/7/13 5:18 PM, dunbarx at aol.com wrote:
-- put random(99) into it --does not work, though it seems like it should
Well, that would just load the variable "it", same as "put random(99)
into var" would.
> "Do" has a bad rep. It does not deserve it.
Sometimes there's no choice, but I avoid it whenever possible because it
slows things down. The compiler has to load every time you use it. Same
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
More information about the Use-livecode