Control names should not be using numbers?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Control names should not be using numbers?

Post by jacque » Fri Jun 24, 2016 4:42 pm

The LC 8 dictionary is in flux, still being converted to a new format. It's being actively worked on but the port was difficult and the fixes have to be done manually. So for now some of us use the LC7 dictionary temporarily.

If you haven't yet read through the user guide, I'd take a look. The overall concepts are described there.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Control names should not be using numbers?

Post by FourthWorld » Fri Jun 24, 2016 5:45 pm

Ed_Ray wrote:Anyway knowing this now I won't just blindly follow the "infallible" syntax like I typically can in other languages but will be more careful in interpreting the INTENT of the syntax when the syntax is suspect.
If you find any documentation that describes the syntax as "infallible" that would be a bug itself, one I'd like to see fixed.

As you say, every language has its strengths and weaknesses. LC is more forgiving of white space than Python, and less cumbersome than double-dereferencing structure handles in C++ and then have to explicitly coerce types. But like any language, LiveCode isn't a magic pony, and it does have a few rules.

Once you learn that this syntax is used for referencing objects by either name or ordinal number:

Code: Select all

get the long id of button <something>
...hopefully it becomes clear that <something> can be a string or an integer, and when it's an integer an ordinal lookup is attempted.

That's pretty much it.

If it's necessary to include an integer in an object's name, you can prepend it with any string to ensure the name will be treated as a string during reference evaluation, e.g.:

Code: Select all

get the long id of button "b12"
Imperfect indeed, and definitely not infallible. But on the whole not bad.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Control names should not be using numbers?

Post by richmond62 » Fri Jun 24, 2016 7:36 pm

If you find any documentation that describes the syntax as "infallible" that would be a bug itself
LC is more forgiving
of almost anything.

Livecode, inevitably, has its short-comings.

But its strengths are what we should be celebrating, as they far out-weigh those short-comings:

1. It is flexible; there are many, many ways to "skin a cat".

2. It has an in-built IDE that does a reasonable job at catching mistakes.

3. None of the code . . . compile . . . run nonsense.

4. WYSWYG.

Yesterday I watched a pupil of mine doing some homework for the Maths High School in C++:
he was doing this on his laptop in a common-or-garden texteditor which, obviously, didn't
"know" right from wrong.

He hates me . . .because I have introduced him to Livecode, but he still has to do

"All That Crap" {His words not mine; Hey, at least I've taught him how to express himself in English!]

in a texteditor for his fossilised teacher at the Maths school, who is fossilised, largely, owing to
a fossilised Education Ministry and so on . . .

Frankly, I'm glad he "hates me" (he said it with a smile on his face) if he realises the value of Livecode.

Post Reply