Page 1 of 1
problem putting values into variable:possible bug?
Posted: Fri May 22, 2015 10:15 pm
by Carlo Diano
I am on a Mackbook air ( iOS 10.10.3.) running Livecode 7.0.5.
I set the property explicitVariables to false, which I also confirmed through the message box, however, when I try to put a field into a variable, I got the following message
"button "strip letters": compilation error at line 2 (Chunk: can't create a variable with that name (explicitVariables?)) near "x", char 43"
.
Here is the very simple code I am using that generated the error message described above
Code: Select all
on mouseUp
put the number of lines of fld "strip" into x
repeat with 1=1 to noLines
put the second item of line i of fld "strip " & return after fld"scramble"
end repeat
end mouseUp
I had the same problem before, running livened 7.0.1. Thanks
Re: problem putting values into variable:possible bug?
Posted: Fri May 22, 2015 10:30 pm
by Simon
Hi Carlo,
Welcome to the forum.
This sounds like you have Strict Compilation Mode enabled which will force you to define x before you use it
local x
on mouseUp
...
Simon
Re: problem putting values into variable:possible bug?
Posted: Fri May 22, 2015 10:30 pm
by FourthWorld
In that handler the variable "nolines" has not been assigned a value.
Re: problem putting values into variable:possible bug?
Posted: Fri May 22, 2015 10:41 pm
by Carlo Diano
FourthWorld wrote:In that handler the variable "nolines" has not been assigned a value.
That is true, however it is irrelevant to my problem; I changed the name of the variable to x from nolines in order to verify that was nothing going on at the level of the name chose for the variable. I hope this clarifies things, Thanks for your reply!
Re: problem putting values into variable:possible bug?
Posted: Fri May 22, 2015 10:52 pm
by Carlo Diano
Simon wrote:Hi Carlo,
Welcome to the forum.
This sounds like you have Strict Compilation Mode enabled which will force you to define x before you use it
local x
on mouseUp
...
Simon
Hello Simon,
thank you so much! That was exactly where the problem lied. So, if I understood correctly, the strict compilation mode "overpowers" the set to false of the explicitVariables property. Thanks again! Carlo
Re: problem putting values into variable:possible bug?
Posted: Sat May 23, 2015 4:52 pm
by jacque
I'd think using an integer as the counting variable would also be illegal. It should be something like:
Re: problem putting values into variable:possible bug?
Posted: Sat May 23, 2015 11:45 pm
by dunbarx
Jacque.
And the rest of the planet.
I would have bet money that the construction:
was indeed illegal. It is not:
Code: Select all
on mouseUp
repeat with 1 = 1 to 3
answer 1 * 5
end repeat
end mouseUp
Now you only get a bunch of "5's", so the construction is not particularly useful, but no error is thrown. And I am not sure what the parser is doing there, multiplying 5 by the, er index variable "1", or the number "1". (Smoke rising from top of head)
I did play around with a few variations, and found that something like this:
Code: Select all
on mouseUp
repeat with 1 = 1 to 3
put "xyz" into 1
end repeat
end mouseUp
threw what I would expect it to at compile time, a bad chunk destination.
I found another way to get an error with the same sort of nonsense, not at compile time, but rather at runTime, and the error was "...bad destination (numeric?)". But I cannot remember what I did to get it.
Anyway, stay away from that sort of thing.
Craig Newman
Re: problem putting values into variable:possible bug?
Posted: Sun May 24, 2015 12:07 am
by jacque
Interesting. The compiler may be interpreting it as (1=1) so it becomes "repeat with true to 3". And then when it tries to deal with that it produces garbage. Or something.
Re: problem putting values into variable:possible bug?
Posted: Sun May 24, 2015 1:32 am
by SparkOut
Typo? 1=1 I think is supposed to be i=1 as in the original post Carlo goes on to say
put the second item of line i ...
That doesn't explain issues with the engine interpreting 1=1 this way though. I think you have it, described in the post above this one jaque
Re: problem putting values into variable:possible bug?
Posted: Sun May 24, 2015 1:41 am
by dunbarx
Yes and no, that is to say, no.
Both:
Code: Select all
repeat with true to 3
and
repeat with "true" to 3
will not compile. I am frightened to death to try:
Craig
Re: problem putting values into variable:possible bug?
Posted: Sun May 24, 2015 2:31 am
by jacque
Oh, right, I'm sure it's a typo now that you mention it. But the tangent has been interesting.
Craig, what's the worst that could happen? So what if you have to restore your hard drive from backups?

Re: problem putting values into variable:possible bug?
Posted: Sun May 24, 2015 9:25 am
by SparkOut
So what if there is no backup to use because the implosion created a black hole and swallowed it. That's right, so what? It would swallow you and me and the world too. And the rest of the solar system. Proxima Centauri is looking a bit nervous as well.