Split is Behaves Unexpectedly?

Ben Rubinstein benr_mc at cogapp.com
Tue Mar 11 12:42:21 EDT 2008

On 19/2/08 20:48, Web Admin Himalayan Academy wrote:
> Mark Smith wrote:
>> However, the solution is very simple:
>> repeat for each line tLine in tList
>>   put tLine into tempLine
>>   <doSomething to tempLine>
>>  end repeat  
> Excellent! I knew it was something simple... split is too important to 
> be broken.  And I can understand the contraints (if you think of it from 
> a binary point of view.. pointers and all...)
> Thanks Mark...
>> On 19 Feb 2008, at 12:37, Björnke von Gierke wrote:
>>> Yes this is completely counter intuitive, and completely stupidly 
>>> broken from a user perspective:
>>> http://quality.runrev.com/qacenter/show_bug.cgi?id=3036
>>> On 19 Feb 2008, at 03:15, chris bohnert wrote:
>>>> from the docs on repeat foreach:
>>>>  Important!  You cannot change the labelVariable in a statement 
>>>> inside the
>>>> loop. Doing so will cause a script error. You can change the content 
>>>> of the
>>>> container, but doing so will probably produce unexpected results.

This is such a common gotcha: on a quick review, I found #248, #1026, #3139, 
#5157, #5605 in addition to the report Björnke cited.

Once upon a time, the compiler caught at least some of these instances, so you 
at least got an immediate error that modifying the loop variable inside the 
loop wasn't supported; however at some point post 2.0 (?) that was lost.

To my mind, this is the kind of efficiency hack/potential cause of confusion 
that Rev should sacrifice in favour of avoiding confusion.  I'd love to see it 
sorted once and for all.  Votes are currently all centered on #3036 - I'd urge 
adding your votes there to help push this issue up RunRev's (post-2.9) 
priority list.

- Ben

More information about the Use-livecode mailing list