repeat with times

Mark Waddingham mark at livecode.com
Fri May 24 13:25:47 EDT 2019


On 2019-05-23 08:42, ambassador--- via use-livecode wrote:
>> After re-reading the release notes I think this is probably the result
>> of bug 20951 being squashed @
>> https://quality.livecode.com/show_bug.cgi?id=20951
> 
> That sounds like it.

Yup - that's the one.

The LCS parser is very lax, it tends not to flag incorrect syntax if it 
can get a reasonable interpretation of what you have written. (i.e. Some 
subset of the line - starting from the first char - makes sense as a 
LiveCode command).

We tend not to fix this (usually benign) lax parsing as it can cause 
scripts which did compile to stop compiling (as some have discovered).

However in this case the lax parsing of repeat is not benign - you can 
write a 'repeat with' statement which looks like it is 100% correct but 
does not do what you expect:

   i.e. repeat with i = 1 to 10 by 2 -- ignores the 'by' clause
        repeat with i = 1 to 10 step 2 -- this is what was meant

Of course ideally the parser would only allow you to use the exact 
syntax the engine defines, rather than ignoring 'junk' at the end of a 
line... Perhaps something we should do for LC-Next...

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the Use-livecode mailing list