how to get the value of a custom property if the name of the cProperty is in a variable?
Mark Waddingham
mark at livecode.com
Tue Aug 8 12:05:37 EDT 2017
On 2017-08-08 17:59, Mark Wieder via use-livecode wrote:
> On 08/08/2017 08:49 AM, hh via use-livecode wrote:
>>> JLG wrote:
>>> In what circumstance would it be necessary to quote the property
>>> name?
>>
>> Use "&" in a key, for example the "G&T" of me
>
> Is there any use case where punctuation in a property name is a good
> idea?
Is there any use case where punctuation in a variable name is a good
idea? ;)
As a custom property set is an unconstrained array; you can actually
have custom properties which have any string as key (set via the
customProperties property) - so it is entirely possible to create such
things. Whether you should or not is another matter, but that's true of
lots of things in LiveCode (and many programming languages in general).
The main issue here (I think) is the inconsistency in evaluation of
quoted literals - it means that you can't say
"A quoted literal always evaluates to the quoted value"
Instead you have to say:
"In all but the case of using the indirect form of setting a custom
property, a quoted literal will evaluate to the quoted value"
Having simple rules which are applicable in all cases both makes things
easier to learn, and harder to make mistakes (because you don't trip
yourself up on unique inconsistencies which you may have never known, or
have forgotten).
Warmest Regards,
Mark.
--
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps
More information about the use-livecode
mailing list