Half Strict Compilation mode
Moderator: Klaus
-
- Posts: 1201
- Joined: Sun Apr 24, 2011 2:17 am
Half Strict Compilation mode
Can we have a Half Strict Compilation mode.
Or in Strict Compilation mode -
a way to exclude " around object names that do NOT have spaces?
Or in Strict Compilation mode -
a way to exclude " around object names that do NOT have spaces?
All my best,
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Re: Half Strict Compilation mode
Hi ...,
Why wouldn't you want to put quotes around object names? Keep your scripts neat and clean for those who come after you, even if you don't think you will be sharing your scripts at this point
The day will come when you will be unable to read your own scripts.
You can set the explicitVariables to false in the preferences window, but I don't think it is meant for this purpose. I believe it is rather meant to avoid declaring local variables.
Mark
Why wouldn't you want to put quotes around object names? Keep your scripts neat and clean for those who come after you, even if you don't think you will be sharing your scripts at this point

You can set the explicitVariables to false in the preferences window, but I don't think it is meant for this purpose. I believe it is rather meant to avoid declaring local variables.
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- Posts: 1201
- Joined: Sun Apr 24, 2011 2:17 am
Re: Half Strict Compilation mode
I usually already know how to use these feature enhancements I'm requesting.
And am reqesting a more effecient way for my style of using the mouse and keyboard.
Having spaces in my control names makes the script hard to read and requires " ".
Having to type " around my control names is 4 extra key strokes per name.
Having a 3 chr prefix to my control names tells me its a control. txt, lbl, lst, cbo, dgd etc.
Making it not only easier to read in the script but in the Application Browser as well.
Would prefer NOT having to tell the compiler my object is a field or a player etc.
I've long ago gotten over the pretention that anyone would waste time rating any of my scripting style.
Prefering the script be readable and to get the job done in the most efficient way possible.
Which is one of the main reasons to move to LiveCode.
And am reqesting a more effecient way for my style of using the mouse and keyboard.
Having spaces in my control names makes the script hard to read and requires " ".
Having to type " around my control names is 4 extra key strokes per name.
Having a 3 chr prefix to my control names tells me its a control. txt, lbl, lst, cbo, dgd etc.
Making it not only easier to read in the script but in the Application Browser as well.
Would prefer NOT having to tell the compiler my object is a field or a player etc.
I've long ago gotten over the pretention that anyone would waste time rating any of my scripting style.
Prefering the script be readable and to get the job done in the most efficient way possible.
Which is one of the main reasons to move to LiveCode.
Last edited by BarrySumpter on Sat Jul 30, 2011 12:04 am, edited 1 time in total.
All my best,
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Re: Half Strict Compilation mode
The problem is, unquoted names are hell for beginners. Consider this simplified example:
Now imagine a lot of other script before the second comment. Someone looking at the code after working on something else however will randomly break the code much easier then when the field references and the strings would be quoted. Sure, a perfect coder can remember everything, or use a prefix like "FLD" if it's a field, but no one is a perfect coder.
Said that, If you like unquoted literals so much, why don't you disable strict mode, and code however you want?
Code: Select all
on mouseUp
--works as expected
put test into field aFieldName
put any line of theList into aFieldName
--hmm randomness is random
put test2 into field aFieldName
end mouseUp
Said that, If you like unquoted literals so much, why don't you disable strict mode, and code however you want?
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
Re: Half Strict Compilation mode
Unquoted literals, such as control names, can sometimes work but decrease the speed of code execution. The compiler has to first determine if there is a variable with that name; if not, it needs to scan all the controls to see if there is one that matches. One of the first things I do when converting or updating client stacks is to go through and quote all the literals, to avoid errors and ensure the code is running as fast as possible.
The ability of the compiler to accept unquoted literals is a leftover that has remained in place for HyperCard compatibility, though LiveCode is more strict about it than HC was. If you don't quote literals, you will eventually find yourself in a situation where your code errors and you don't know why. Not all unquoted literals will work; it depends on where in the command line the literal occurs.
The benefits are worth the 2 keystrokes.
The ability of the compiler to accept unquoted literals is a leftover that has remained in place for HyperCard compatibility, though LiveCode is more strict about it than HC was. If you don't quote literals, you will eventually find yourself in a situation where your code errors and you don't know why. Not all unquoted literals will work; it depends on where in the command line the literal occurs.
The benefits are worth the 2 keystrokes.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 1201
- Joined: Sun Apr 24, 2011 2:17 am
Re: Half Strict Compilation mode
H Bvg,
In my opinion,
I think you're writing a bit too much about others as if you represent someone other than yourself.
Just make your point as best you can.
Take a break and come back to this if you feel it's really important enough to spend you're time on.
And not jut something to write about.
Otherwise, in my opinion, this is not a reasonable argument.
I wouldn't use the prefix fld on any object name.
It's too generic and defeats the purpose of using a prefix.
And truely its my job as a software developer, when working on legacy code, to not only come to terms with someone elses style of writing scripts but to adapt to it quickly and update the scripts and enhance the scripts in a way that no one knows that another developer updated or enhanced the script other than the change log.
I was doing this long before someone came up with "egoless coding".
I've seen scripting in my time that looks like a dogs breakfast.
Which the developers were happy to put their names to it.
I found out laster that one of the developer had a really good name in the company.
They though he was the best thing since sliced bread and were sorry he left to go work for M$.
LOL
So I prefer not to waste my time anymore discussing others scripting style.
In my opinion,
I think you're writing a bit too much about others as if you represent someone other than yourself.
Just make your point as best you can.
Take a break and come back to this if you feel it's really important enough to spend you're time on.
And not jut something to write about.
Otherwise, in my opinion, this is not a reasonable argument.
I wouldn't use the prefix fld on any object name.
It's too generic and defeats the purpose of using a prefix.
And truely its my job as a software developer, when working on legacy code, to not only come to terms with someone elses style of writing scripts but to adapt to it quickly and update the scripts and enhance the scripts in a way that no one knows that another developer updated or enhanced the script other than the change log.
I was doing this long before someone came up with "egoless coding".
I've seen scripting in my time that looks like a dogs breakfast.
Which the developers were happy to put their names to it.
I found out laster that one of the developer had a really good name in the company.
They though he was the best thing since sliced bread and were sorry he left to go work for M$.
LOL
So I prefer not to waste my time anymore discussing others scripting style.
Last edited by BarrySumpter on Sat Jul 30, 2011 12:00 am, edited 4 times in total.
All my best,
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
-
- Posts: 1201
- Joined: Sun Apr 24, 2011 2:17 am
Re: Half Strict Compilation mode
Hi Jaque,
Again, just my opinion.
If there is a time differenct then it would be in milliseconds.
And the point is probably an urban ledgend. Based on truth but no longer really relivant.
And it's probably wasting your time and your clients money double quoting.
Where the client would get more benifit puttin the money towards a faster computer.
If it were that importand RunRev needs to udpate the script editor
to insert a spaceDoubleDoubleQuote afte each word 'field', DataGrid, Lable, etc
expecting an object name.
And if it were that importand I should have read about it in the Put and Set commands.
Its 4 key strokes per object name while I'm scripting.
Again, just my opinion.
If there is a time differenct then it would be in milliseconds.
And the point is probably an urban ledgend. Based on truth but no longer really relivant.
And it's probably wasting your time and your clients money double quoting.
Where the client would get more benifit puttin the money towards a faster computer.
If it were that importand RunRev needs to udpate the script editor
to insert a spaceDoubleDoubleQuote afte each word 'field', DataGrid, Lable, etc
expecting an object name.
And if it were that importand I should have read about it in the Put and Set commands.
Its 4 key strokes per object name while I'm scripting.
All my best,
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Half Strict Compilation mode
Microseconds, actually. About 0.01 microseconds, to be precise (at least on my machine). A few microseconds here, a few microseconds there, and sooner or later you could be looking at a whole millisecond wasted.BarrySumpter wrote:If there is a time differenct then it would be in milliseconds.

But seriously, I see no harm and some usefulness in adopting performance-enhancing habits where practical, even if the per-instance benefit is low.
While a small performance difference, it's quite real and even measurable, and logically deducible given Jacque's explanation: Any quoted string is known at compile time to be a literal, but unquoted strings need to be compared against a list of known tokens and only when no match is found is it assumed to be a string. Quoting literals bypasses that lookup.And the point is probably an urban ledgend. Based on truth but no longer really relivant.
For myself, the biggest benefit of quoting literals isn't for the machine but for the human. When I go back to code six months later, or bring a new programmer on the team reading my code for the first time, quoted strings are immediately recognizable as literals, without having to remember all the variable names I might be using at the time.And it's probably wasting your time and your clients money double quoting.
IMO anything that improves the skimmability of code is money well spent, esp. if the cost is as low as adopting a habit of typing two extra characters.
But what if the scripter intends to use another form of reference, like "field 1" or "field tMyVarialbleContainingAFieldNameOrNumber"?If it were that importand RunRev needs to udpate the script editor
to insert a spaceDoubleQuote afte each word 'field' expecting a name.
If you'd been working in this family of languages as long as Jacque has you probably would have.And if it were that importand I should have read about it before now.

Respectfully, it may just be that others don't feel it's as inconvenient as you do. Few languages allow unquoted literals at all, so it may be that most folks just picked up this habit long ago and haven't thought much about it since.
It might be handy if there was a way to know for sure that the scripter is intending to use the string following the "field" keyword as a literal. If you can come up with an algo for that I'd submit it to the RQCC for you.Its 4 key strokes per object name while I'm scripting.
Hunting and finding would add to that time.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Half Strict Compilation mode
Of course you can ignore any argument by claiming I do not talk about whatever you want to talk about. My question still is why setting the strict mode to off is not suitable for your goals?
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
-
- Posts: 1201
- Joined: Sun Apr 24, 2011 2:17 am
Re: Half Strict Compilation mode
bvg,
I've eplained it as best I can.
If you can't understand it there's nothing more I can offer.
I've eplained it as best I can.
If you can't understand it there's nothing more I can offer.
All my best,
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Re: Half Strict Compilation mode
Sure. I'm not clear on why you're against turning off an option, but you must have reasons. I never run with explicitVariables turned on, but some people swear by it. It's one of those religious arguments. That and color coding, which makes me blind.BarrySumpter wrote:Hi Jaque,
Again, just my opinion.
Nope, as Richard said, it really helps not only the computer but me. But get this: remember the custom backscript I told you about? The one you put in a custom plugin? Mine also has a custom frontscript. I can quote literals with one keystroke. Beat that.And it's probably wasting your time and your clients money double quoting.
Where the client would get more benifit puttin the money towards a faster computer.

If you're nice to me, I might tell you how.
Okay, I give. You're counting the shift key separately, maybe?Its 4 key strokes per object name while I'm scripting.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Half Strict Compilation mode
I reread the whole thread, and nowhere did i see you explaining why having strict mode off does not offer you what you need, respectievly why you don't like that?BarrySumpter wrote:bvg,
I've eplained it as best I can.
If you can't understand it there's nothing more I can offer.
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
-
- Posts: 1201
- Joined: Sun Apr 24, 2011 2:17 am
Re: Half Strict Compilation mode
Not sure why this didn't post yesterday:
Hi ForthWorld,
Having a hard time following your - measurable in micoSeconds savings but do it anyway logic.
LOL
Hard to teach an old dog new tricks I guess.
Again, not following about beginners.
If they are new then they are either learning your coding style or mine or someone elses.
And probably a conglomeration of all if its legacy.
So it would be best I tought them to open their mind and be ready for various coding styles.
Can't see me using "Field 1" as a field name and expect to be able to understand the logic an hour later?
Instead use
field txtPostCode
or
field lstStates
as compared to
field txtState
as compared to
label lblState
as compared to
datagrid dgdStates
15 years of experience is long enogh to develop a habit that is no longer neccessary.
Try 30+ years and bad habits start to out number good ones. LOL
No tlooking for anthing near perfection. Just efficient.
Is <space>field<space> unique enough for the script editor to recognize?
Sould be since the compiler recognizes it.
And again, another option in preferences to turn on or off.
I'd prefer the compiler do all the work
and recognise my txt and dgd prefixes as a field and datagrid respectively.
So I wouldn't have to qualify using field or datagrid.
Perhaps its every compiler for a language that needs the qualifier:
Dim dgdStates as DataGrid, etc.
or
With dgdStates as DataGrid
...
Set the contents of dgdStats to Empty
...
end with
----
Also, along these lines can I force the test editor to capitalize these reserved workds?
field - FIELD
label - LABEL
datagrid - DATAGRID
Hi ForthWorld,
Having a hard time following your - measurable in micoSeconds savings but do it anyway logic.
LOL
Hard to teach an old dog new tricks I guess.

Again, not following about beginners.
If they are new then they are either learning your coding style or mine or someone elses.
And probably a conglomeration of all if its legacy.
So it would be best I tought them to open their mind and be ready for various coding styles.
Can't see me using "Field 1" as a field name and expect to be able to understand the logic an hour later?
Instead use
field txtPostCode
or
field lstStates
as compared to
field txtState
as compared to
label lblState
as compared to
datagrid dgdStates
15 years of experience is long enogh to develop a habit that is no longer neccessary.
Try 30+ years and bad habits start to out number good ones. LOL
No tlooking for anthing near perfection. Just efficient.
Is <space>field<space> unique enough for the script editor to recognize?
Sould be since the compiler recognizes it.
And again, another option in preferences to turn on or off.
I'd prefer the compiler do all the work
and recognise my txt and dgd prefixes as a field and datagrid respectively.
So I wouldn't have to qualify using field or datagrid.
Perhaps its every compiler for a language that needs the qualifier:
Dim dgdStates as DataGrid, etc.
or
With dgdStates as DataGrid
...
Set the contents of dgdStats to Empty
...
end with
----
Also, along these lines can I force the test editor to capitalize these reserved workds?
field - FIELD
label - LABEL
datagrid - DATAGRID
All my best,
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Re: Half Strict Compilation mode
not at all. ConsiderIs <space>field<space> unique enough for the script editor to recognize?
Code: Select all
put "CustomerName" into tFldname
put "Milo Fenderbender" into field tFldname
Code: Select all
put "Milo Fenderbender" into field CustomerName
Re: Half Strict Compilation mode
Good point. And there's the oft-used:
Which would result in: Error, no such object.
Code: Select all
repeat for each item i in tFieldList
put empty into field i
end repeat
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com