Repeat ... kind'a

Peter Haworth pete at lcsql.com
Thu Apr 30 18:54:16 EDT 2015


I ran into a similar situation once with a leftover "break" command when
converting a switch statement to a series of if statements.  Might be worth
including that in the QCC report

Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>

On Thu, Apr 30, 2015 at 3:33 PM, Richard Gaskin <ambassador at fourthworld.com>
wrote:

> Terry Dennis wrote:
>
> > Much fiddling later, I discovered the issue.  It was a runtime
> > “oops”.
> > Check out the following code snippet, which shows the execution
> > error.  I threw it into button “Capture”s script:
> >
> > on testOOPS
> >    put 1 into t1  -- Superfluous for testing purposes
> >    put 2 into t2  -- Superfluous for testing purposes
> >    if true = true then  -- Runtime error here !!!
> >       exit repeat
> >    end if
> >   put 3 into t3  -- Superfluous for testing purposes
> > end testOOPS
> >
> > <<<<
> > button "Capture": execution error at line 27 (Handler: error in
> statement),
> > char 1
> >>>>>
> >
> > I certainly didn’t expect an execution error on an “if true then”
> > statement.
> >
> > The problem is the code I copied included an “exit repeat”, but the
> > function I copied it into didn’t have a “repeat ... end repeat”.
> > Thus, there was an “unmatched” exit from a repeat that didn’t
> > exist.
> ...
> > It seems to me this is a bug that should have been caught during the
> > script compilation phase, instead of during execution.
>
> Agreed.  If you substitute "exit repeat" with any other equally irrelevant
> expression like "exit foo" or "exit if" etc. the compiler flags it
> immediately, and ideally it should do the same here too.
>
> It may also be worth noting in the report that the error is flagged on the
> wrong line.  Hopefully once they fix the compiler to catch this it'll
> identify the actual erroneous line as a compilation error and we won't ever
> see an incorrect line flagged for an execution error.
>
> But since it is flagging the wrong line, drawing attention to that may
> provide an opportunity to review that part of the code to make sure
> incorrect lines aren't being flagged in other contexts.
>
> If you file a report please note the number here so I can add myself to
> the report's CC list.  Thanks.
>
> --
>  Richard Gaskin
>  Fourth World Systems
>  Software Design and Development for the Desktop, Mobile, and the Web
>  ____________________________________________________________________
>  Ambassador at FourthWorld.com                http://www.FourthWorld.com
>
> _______________________________________________
> 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



More information about the use-livecode mailing list