Page 1 of 2

Forget the comma thread. Now lose semicolons

Posted: Wed Jun 28, 2017 4:18 pm
by dunbarx
In a button script with a field a card.

Code: Select all

on mouseUp
   put random(99) into fld 1  wait 10   answer "whew" put random(99)  into fld 1  put random(99) * 2.4545656467 into fld 1  put fld 1 ^ 3 into fld 1
end mouseUp
No semiColons required to separate what I thought would not compile at all. Apparently, LC needs very little in the way to understand that many separate commands can exist in a single line. Why ever bother with the return char? Has this always been OK? Is this in fact OK?

Craig Newman

Re: Forget the comma thread. Now lose semicolons

Posted: Thu Jun 29, 2017 2:44 pm
by Mikey
It is ok, and it's great if you want to debug your compiled app with just an ask dialog, or if you want to use the single-line message box to get the value of some global container

Code: Select all

global foo;put foo

Re: Forget the comma thread. Now lose semicolons

Posted: Thu Jun 29, 2017 3:01 pm
by Klaus
I always stick to the "official" syntax etc. and don't pay any attention to things that "somehow work, by chance and inofficially"!
This way my life is much easier and I have a lot more time at hand... :D

Re: Forget the comma thread. Now lose semicolons

Posted: Thu Jun 29, 2017 3:03 pm
by Mikey
I'm pretty sure it's official, since I didn't even realize it was available until somebody at LC shared it.

Re: Forget the comma thread. Now lose semicolons

Posted: Thu Jun 29, 2017 3:14 pm
by Klaus
If it is not documented, I do not consider it official!

Re: Forget the comma thread. Now lose semicolons

Posted: Thu Jun 29, 2017 3:38 pm
by Mikey
Then synonyms aren't either...

Re: Forget the comma thread. Now lose semicolons

Posted: Thu Jun 29, 2017 3:53 pm
by Mikey
FYI, I spent less than a minute searching for the origin of this, so I'm sure there's something earlier, but
http://www.mactech.com/articles/mactech ... index.html
and
http://lists.runrev.com/pipermail/use-l ... 13918.html

Re: Forget the comma thread. Now lose semicolons

Posted: Thu Jun 29, 2017 3:56 pm
by Mikey
It's also documented in the dictionary. I didn't bother to look there, first.

Re: Forget the comma thread. Now lose semicolons

Posted: Thu Jun 29, 2017 5:01 pm
by dunbarx
Mikey.

Two things going on here. One is about the looseness of LC syntax, and an unexpected subthread about synonyms.

Syntax.

I am with Klaus. Never mind the fact that LC seems to have a magical omniscient parser, this phenomenon is not documented, ought not to even work, and so is relegated to astonishing esoterica. Esoterica that I absolutely would not trust at all. Never mind again that, say, the example I posted is nearly impossible to read.

It all derived from the recent thread about not needing commas to pass parameters. You don't even need punctuation to combine lines of code. I refuse to experiment on how far this can be stretched...
global foo;put foo
Not sure what you meant here. You have semicolons.
It is ok, and it's great if you want to debug your compiled app with just an ask dialog,
Intrigued about this. Can you elaborate?

Craig

Re: Forget the comma thread. Now lose semicolons

Posted: Thu Jun 29, 2017 5:17 pm
by Mikey
Ah. That is weird. I wonder what is going on, there. I could have sworn I saw sems in the original code.

Re: Forget the comma thread. Now lose semicolons

Posted: Thu Jun 29, 2017 5:31 pm
by Klaus
Mikey wrote:It's also documented in the dictionary. I didn't bother to look there, first.
Please give me a hint where to look for that in the dictionary, thank you.

Re: Forget the comma thread. Now lose semicolons

Posted: Thu Jun 29, 2017 6:27 pm
by dunbarx
Mikey,

Ah.

So now you see my point? There aint nothing but spaces between those separate commands, and there aint nothing but spaces between the words of those commands.

Craig

Re: Forget the comma thread. Now lose semicolons

Posted: Thu Jun 29, 2017 6:56 pm
by Mikey
Klaus,
I misread the posts. I thought you guys were referring to the semicolon, so kindly ignore everything I typed on this thread.

Re: Forget the comma thread. Now lose semicolons

Posted: Thu Jun 29, 2017 7:00 pm
by Klaus
Mikey wrote:Klaus,
I misread the posts. I thought you guys were referring to the semicolon, so kindly ignore everything I typed on this thread.
Ah, OK. :D

Re: Forget the comma thread. Now lose semicolons

Posted: Thu Jun 29, 2017 8:23 pm
by dunbarx
Well, indirectly, I was. The thread title does mention it, after all.

One may string lines of code on a single physical line if you delimit with semicolons:

Code: Select all

doThis ; doThat; answer the date; put 5 into fld 1
I rarely use this because I just don't see the downstream snippets easily. Though sometimes, with very closely related snippets, the compactness is nice.

This thread discovers that the semicolons are not required. LC seems to be able to parse a string of words into a group of sensible commands.

Code: Select all

doThis  doThat answer the date  put 5 into fld 1
That was amazing to me.

Craig