local and do <commands> - what NOT to do

Mike Kerner MikeKerner at roadrunner.com
Thu Feb 18 22:28:09 EST 2016


I skipped a few in the middle, here, but one case where I use do and value
is in lieu of having pointers, something that is not very easily replaced
by an array.  Using value and do allow me to write generic routines for
populating forms and updating database tables afterwards, using the field
names and variable names that match the name of the field in the database
table.

If I was to use arrays to replace this behavior, I would also have to use
object numbers on fields as the reference and then keep the objects
numbered correctly, or use object ID's and then have a lookup table to
correlate the index of the array, the object id, and the field name in the
DB.


On Thu, Feb 18, 2016 at 7:15 AM, Kay C Lan <lan.kc.macmail at gmail.com> wrote:

> On Thu, Feb 18, 2016 at 7:52 PM, Mark Waddingham <mark at livecode.com>
> wrote:
>
> >
> >> Okay so this kind of code pattern originates from HyperCard which did
> not
> > have arrays.
> >
> > Upshot: There's no reason to use 'local' in do if you are initializing
> the
> > variable at that point. Indeed, one could argue that it is better to do:
> >
> >   do "put empty into tVar_" & x
>
>
> Which all goes to reinforce my initial feeling; the Example given in the
> Dictionary for <local> is negative learning. Noted added to my ever
> increasing pile of Dictionary improvements.
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."



More information about the Use-livecode mailing list