Re: Clearing local variables

2016-05-03 Thread Bob Sneidar
I do the exact same thing Peter. I learned this when I was developing for a dBase accounting application. All their control structures and terminations were commented quite extensively, and I was able to learn dBase and their code specifically because they did. Bob S On Apr 30, 2016, at

Re: Clearing local variables

2016-05-02 Thread Devin Asay
> On Apr 29, 2016, at 9:17 AM, Mark Waddingham wrote: > > On 2016-04-29 04:30, Kay C Lan wrote: >> On Thu, Apr 28, 2016 at 11:47 PM, Mark Waddingham wrote: >>> From 7.0 onwards, this causes no problem as the engine takes a 'copy' of >>> the target variable

Re: Clearing local variables

2016-04-30 Thread Peter M. Brigham
I generally do the same thing with nested repeats, but my comments are different: On Apr 30, 2016, at 2:13 AM, Kay C Lan wrote: > On Sat, Apr 30, 2016 at 9:19 AM, Dr. Hawkins wrote: > >> Exiting an outer loop from within an inner takes >> contortions, but figuring out

Re: Clearing local variables

2016-04-30 Thread Kay C Lan
On Sat, Apr 30, 2016 at 9:19 AM, Dr. Hawkins wrote: > Exiting an outer loop from within an inner takes > contortions, but figuring out which end is attached to which if or repeat > is time consuming. > > I know you've figured it out but for any noobs reading this and

Re: Clearing local variables

2016-04-29 Thread Peter Haworth
lcStackbrowser has a feature that adds comments to each end xxx statement identifying it's parent, part of the script assist module. I think named ifs, repeats, etc would be great on the context of being able to exit out of nested instances of those structures to whatever level you want. On Fri,

Re: Clearing local variables

2016-04-29 Thread Dr. Hawkins
On Fri, Apr 29, 2016 at 5:40 PM, Alex Tweedly wrote: > Do you simply want to *see with certainty", or do you want to use these > tags (e.g. for exiting a control structure) ? > > Both, actually. Exiting an outer loop from within an inner takes contortions, but figuring out

Re: Clearing local variables

2016-04-29 Thread Alex Tweedly
On 30/04/2016 00:49, Dr. Hawkins wrote: The other thing I desperately want is the ability to tag loops, as in Fortran, so that I can see with certainty which end goes with which repeat or if. Do you simply want to *see with certainty", or do you want to use these tags (e.g. for exiting a

Re: Clearing local variables

2016-04-29 Thread Dr. Hawkins
On Fri, Apr 29, 2016 at 2:19 PM, Bob Sneidar wrote: > The best place to get C style scoping is to use a C style development > environment. Really. The last thing I want is to make Livecode MORE like > all the dev environments I simply do not have enough life left to

Re: Clearing local variables

2016-04-29 Thread Bob Sneidar
The best place to get C style scoping is to use a C style development environment. Really. The last thing I want is to make Livecode MORE like all the dev environments I simply do not have enough life left to master. Bob S On Apr 29, 2016, at 09:25 , Dr. Hawkins

Re: Clearing local variables

2016-04-29 Thread Dr. Hawkins
On Fri, Apr 29, 2016 at 8:21 AM, Richard Gaskin wrote: > If you find yourself needing to clear variables of a particular scope, > maybe that's reason to consider a narrower scope. > C-style variable scope is near the top of met live code wishlist . . . -- Dr.

Re: Clearing local variables

2016-04-29 Thread Mark Waddingham
On 2016-04-29 17:24, Richard Gaskin wrote: In the rare cases where we might want to modify the string being traversed, does the "repeat with i = 1 to..." form still allow that? Yes - you can still modify the string being traversed with repeat for each, but the modifications won't actually

Re: Clearing local variables

2016-04-29 Thread Richard Gaskin
Mark Waddingham wrote: > On 2016-04-29 04:30, Kay C Lan wrote: >> Does that mean the 'Important' note in the LC 8 Dictionary entry for >> 'repeat' isn't so Important any more? > > Yes! That note should probably be replaced by one which says you can > modify the target variable in the loop, but

Re: Clearing local variables

2016-04-29 Thread Richard Gaskin
Bob Sneidar wrote: > Agreed, but then you need to be careful about what any of your > variables contain. :-) This sort of hints at a question I've been wondering throughout this thread: why is this needed? If you find yourself needing to clear variables of a particular scope, maybe that's

Re: Clearing local variables

2016-04-29 Thread Mark Waddingham
On 2016-04-29 04:30, Kay C Lan wrote: On Thu, Apr 28, 2016 at 11:47 PM, Mark Waddingham wrote: From 7.0 onwards, this causes no problem as the engine takes a 'copy' of the target variable at the start of the loop. (Note you only pay for that copy when you mutate tList

Re: Clearing local variables

2016-04-29 Thread Bob Sneidar
Agreed, but then you need to be careful about what any of your variables contain. :-) As for tVar, I wasn't aware that you *could* modify it now. Last time I did this is when I started working with this repeat form, which I use religiously now, and ended up with scary nonsense in x.

Re: Clearing local variables

2016-04-28 Thread Kay C Lan
On Thu, Apr 28, 2016 at 11:47 PM, Mark Waddingham wrote: > > From 7.0 onwards, this causes no problem as the engine takes a 'copy' of > the target variable at the start of the loop. (Note you only pay for that > copy when you mutate tList subsequently, and that mutation has no

Re: Clearing local variables

2016-04-28 Thread Mark Waddingham
On 2016-04-28 03:31, Kay C Lan wrote: If you do not understand what isn't 'variable' and what really gets checked at each iteration for each style of repeat then you are likely to see some unexpected results. On the other hand, if do understand what is really going on, then you can modify x to

Re: Clearing local variables

2016-04-28 Thread Richard Gaskin
Possibly tricky, but this should work, no?: set the script of tObj to the script of tObj -- Richard Gaskin Fourth World Systems Software Design and Development for the Desktop, Mobile, and the Web

Re: Clearing local variables

2016-04-27 Thread Kay C Lan
On Wed, Apr 27, 2016 at 11:32 PM, Bob Sneidar wrote: > > well... to be clear, you can in a repeat with x = 1 to n form. Well to be really clear you NEED to be careful if you intend to modify x or tVar in both cases: repeat with x = 1 to the number of items in tVar

Re: Clearing local variables

2016-04-27 Thread Bob Sneidar
On Apr 22, 2016, at 13:04 , stephen barncard > wrote: you don't want to mess with the index variable in a repeat loop well... to be clear, you can in a repeat with x = 1 to n form. It's in the repeat for each form you

Re: Clearing local variables

2016-04-25 Thread Dave Cragg
This is slight variation of Craig's solution. It works if you want to delete all local variables declared outside of handlers. (it's used inside libUrl) on ulDeleteLocals local e repeat for each item e in line 3 of the localNames get "delete" && "local" && e do it end repeat end

Re: Clearing local variables

2016-04-22 Thread Dick Kriesel
Craig’s code works. I should’ve tested. As a design alternative, you could use a single local variable for all those arrays. Then you could reinitialize without invoking "do;" code that applies to multiple arrays may be less verbose. — Dick ___

Re: Clearing local variables

2016-04-22 Thread dunbarx
eCode <use-livecode@lists.runrev.com> Sent: Fri, Apr 22, 2016 4:06 pm Subject: Re: Clearing local variables On Fri, Apr 22, 2016 at 12:48 PM, Sannyasin Brahmanathaswami < brahma@hindu.orgbra...@hindu.org> wrote: > repeat for each item x in tLocalVars > put empty int

Re: Clearing local variables

2016-04-22 Thread stephen barncard
On Fri, Apr 22, 2016 at 12:48 PM, Sannyasin Brahmanathaswami < bra...@hindu.org> wrote: > repeat for each item x in tLocalVars > put empty into x >end repeat > you don't want to mess with the index variable in a repeat loop repeat for each item x in tLocalVars put empty into

Re: Clearing local variables

2016-04-22 Thread Dick Kriesel
> On Apr 22, 2016, at 12:48 PM, Sannyasin Brahmanathaswami > wrote: > > repeat for each item x in tLocalVars >put empty into x > end repeat repeat for each item x in tLocalVars set the text of x to empty end repeat ___

Clearing local variables

2016-04-22 Thread Sannyasin Brahmanathaswami
When doing list processing… it is not unusual to end up with duplicated data in persistent variables. Local tWhatEverList # is persistent, like a global, for the script that contains it. So if you are putting data into it on a repeat loop… it gets added every time the cmd/fnc is called. I