Page 2 of 3
Re: Alternative to PUT value INTO variable
Posted: Mon Mar 31, 2014 4:58 pm
by richmond62
"No one is proposing to remove PUT, just create an alternative shortcut syntax allowing people to choose."
Right: gottit.
Still not all that keen on it as I wonder if it wouldn't just obfuscate things.
Re: Alternative to PUT value INTO variable
Posted: Mon Mar 31, 2014 10:48 pm
by RickA1
richmond62 wrote:"No one is proposing to remove PUT, just create an alternative shortcut syntax allowing people to choose."
Right: gottit.
Still not all that keen on it as I wonder if it wouldn't just obfuscate things.
I'm sure both are clear about the meaning. I feel the opposed, the proposal makes it more clear. But as I FEEL one way, you FEEL differently.
Some people will feel like you, and some, math oriented lazy people, like me. There is no wrong way here.
Probably the first one works better for the language oriented person, and the last one for the math oriented person.
PUT 4 * x INTO t1
PUT t1 / 3 INTO t2
PUT random(255) INTO rnd1
SET t1 = 4 * x,
t2 = t1 / 3,
rnd1 = random(255)
PUT inc(inc1) INTO inc1 -- up
PUT dec(dec1) INTO dec1 -- down
SET inc1 = inc(inc1), dec1 = dec(dec1) -- up/down
Re: Alternative to PUT value INTO variable
Posted: Thu May 01, 2014 11:46 am
by malte
For the multiline version of set, I would miss an end SET. With SET being a shorter alternative to put into I would not have too much of a problem. I might even want to adopt it, as it would avoid having stray puts all over the place
Cheers,
Malte
Re: Alternative to PUT value INTO variable
Posted: Thu May 01, 2014 9:42 pm
by [-hh]
..........
Re: Alternative to PUT value INTO variable
Posted: Fri May 02, 2014 8:13 am
by richmond62
I think that "main point" is probably better than "big point" :/
Re: Alternative to PUT value INTO variable
Posted: Tue Sep 18, 2018 7:22 am
by pderocco
I was going to suggest this, but found this old thread. I'd like to see support for a simple "x = expr" syntax, interpreted as an assignment if it's not in the middle of an expression where it could be a boolean. The main reason is that a lot of us probably code in other languages besides LiveCode, and we find ourselves typing that without thinking, getting an error, and having to fix it.
It would be nice if you could put "lvalue" chunk expressions to the left of the equals sign, although it might simplify the parser if they had to be parenthesized.
Re: Alternative to PUT value INTO variable
Posted: Tue Sep 18, 2018 11:28 am
by Klaus
Hi Paul,
don't exspect to see this anytime soon in LC!
Best
Klaus
Re: Alternative to PUT value INTO variable
Posted: Tue Sep 18, 2018 3:09 pm
by bogs
I wouldn't expect to see this ever, as the convention your using is closer to using a language other than an xcode language as has been pointed out earlier.
Aside from that, though, I can't even begin to picture the train-wrecks that would happen to you bringing past code up the ladder to newer IDEs

Re: Alternative to PUT value INTO variable
Posted: Tue Sep 18, 2018 5:52 pm
by mwieder
If you want to monkeypatch your own preprocessor into the script editor, here's the code to handle the conversion. The works well for script-only stacks because you can write the code in a text file with a normal text editor, then run the conversion in memory so that the LC compiler doesn't choke. YMMV.
Code: Select all
# process "normal" variable assignment
# x = 3
# if x == 3 then
# if x != 3 then
local txCode, tSavedDelimiter
put the itemDelimiter into tSavedDelimiter
set the itemDelimiter to "="
repeat for each line tLine in tScript
switch word 1 of tLine
case "constant"
break
case "if"
replace "==" with "is" in tLine
replace "!=" with "is not" in tLine
case "repeat"
case "put"
break
default
# assignments
if "=" is among the tokens of tLine then
put "put" && item 2 of tLine && "into" && item 1 of tLine into tLine
end if
end switch
put tLine & cr after txCode
end repeat
set the itemDelimiter to tSavedDelimiter
put txCode into tScript
Re: Alternative to PUT value INTO variable
Posted: Wed Sep 19, 2018 12:53 am
by pderocco
Another possibility is to use a different operator, like := used in Algol and Pascal. Then, it could be made part of the expression syntax, so one could write
or
Sure, it's different from what LiveCode is now, but having to say "put 0 into i" is one of the ugliest things about the LiveCode language.
Re: Alternative to PUT value INTO variable
Posted: Mon Sep 24, 2018 6:13 pm
by bogs
pderocco wrote: Wed Sep 19, 2018 12:53 am
"put 0 into i" is one of the ugliest things about the LiveCode language.
I would say beauty is in the eye of the beholder. I came here from standard (and not so standard) languages, I rather like the way this language flows
now that I have gotten used to it.
When I first started using it, my thinking was more like yours. Of course, if they started changing all the conventions to be like every other language, what would be the point to using this one?
I might add that if you really like pascal, then use pascal (I still do on occaision), but don't try to change Lc into pascal, not only would you break the heck out of stuff, it is pointless since there already is a pascal

Re: Alternative to PUT value INTO variable
Posted: Mon Sep 24, 2018 6:55 pm
by richmond62
one of the ugliest things about the LiveCode language
Let's all get down-and-dirty with subjective statements like that.
Re: Alternative to PUT value INTO variable
Posted: Mon Sep 24, 2018 7:01 pm
by Klaus
Re: Alternative to PUT value INTO variable
Posted: Tue Sep 25, 2018 1:09 am
by FourthWorld
pderocco wrote: Wed Sep 19, 2018 12:53 am
...having to say "put 0 into i" is one of the ugliest things about the LiveCode language.
For me the difference between "=" and "==" is one of the ugliest things about a dozen other languages.
De gustibus non est disputandem.
Re: Alternative to PUT value INTO variable
Posted: Tue Sep 25, 2018 2:58 am
by bogs
FourthWorld wrote: Tue Sep 25, 2018 1:09 am
De gustibus non est disputandem.
While that is probably the way it should be, in reality it rarely works out eh
FourthWorld wrote: Tue Sep 25, 2018 1:09 am
For me the difference between "=" and "==" is one of the ugliest things about a dozen other languages.
Sure, but if you take that to its ultimate evolution, you get (='.'=), which I'm sure you'd agree is a thing of beauty
