Goodbye stsMLXEditor

Kay C Lan lan.kc.macmail at gmail.com
Mon Aug 31 02:46:31 CEST 2015


On Mon, Aug 31, 2015 at 6:31 AM, Peter Haworth <pete at lcsql.com> wrote:

> I decided to give this another try since I really like using Textmate.
>
> Thank you.

>
> However it seems that not all errors are detected.  So far the missing
> errors are those associated with Strict Compile mode, e.g. missing local
> variable definitions, missing quotes around certain language elements.
>

In the 7.1 rc 1 Dictionary it says this under the 'script' property entry:

LiveCode compiles the script immediately after it is set.

For the 'scriptParsingError' message entry:

Sent to an object when its script cannot be compiled.

Followed by this VERY important Note:

The scriptParsingError message is no longer sent. Instead, any parse error
is now put into the result immediately after setting the script of an
object.

So I:

New Main Stack
Added a button and named it 'one'
Added a button and named it 'two'

In btn one added a script:

on mouseUp
   if (the script of btn "two" = empty) then
      set the script of btn "two" to "on mouseUp" & cr & \
            "repeat with x = 1 to 10" & cr & \
            "put " & quote & "A" & quote & "x into y" & cr & \
            "end repeat" & cr & \
            "put y into msg" & cr & \
            "end mouseUp"
   else
      set the script of btn "two" to empty
   end if
   put the result into msg
end mouseUp

Apply

Clicked on btn 'one' and I get this:

117,3,8
265,3,8
394,3,8
395,3,8
319,3,8
166,3,8
165,3,8

I was expecting an error, because the line:

put "A"x into y

is wrong, but the msg if I were to Apply that script in the Script Editor
is:

button "two": compilation error at line 3 (Expression: bad factor), char 8

So I can figure out the relationship between the 3 and the 8, but the fist
number on each line is pretty cryptic.

With Strict Compilation turned On, if I amend the offending line to:

 "put " & quote & "A" & quote & " & x into y" & cr & \

And click btn 'one' I get no errors. But if I open the script to btn 'two'
when it contains the script:

on mouseUp
repeat with x = 1 to 10
put "A" & x into y
end repeat
put y into msg
end mouseUp

and Apply it I get the Error msg:

button "two": compilation error at line 3 (Chunk: can't create a variable
with that name (explicitVariables?)) near "y", char 13

So this wouldn't appear to be anything to do with sts but how LC handles
'set the script of' and apparently a different level of syntax checking
when compared to using the SE's Apply btn.

Nice find Peter!

There would seem to be two issues, firstly the different level of
Compilation checking, and secondly, the Dictionary entry for
'scriptParseError' implies that the error message we are going to get is
human readable. What currently is presented in the result is of little use
unless there is documentation to decipher the numbers; although the SE
style error message is really what we want.


More information about the use-livecode mailing list