Case sensitivity in Livecode ??
Alex Tweedly
alex at tweedly.net
Wed Jun 1 14:54:18 EDT 2022
On 01/06/2022 18:05, Mark Waddingham via use-livecode wrote:
>
> Anyway, this rather odd and obscure facet of the language will
> disappear in 10 as we've made it so that initializers for constants
> and locals can be constant expressions. Thus:
>
> constant kTrue = TRUE
> local sEmptyString = empty
>
> Will do precisely what they look like they should do...
>
Good.
> Also, you'll be able to do things like:
>
> constant kPiBy2 = pi / 2
> constant kPiBy2Squared = kPiBy2 * kPiBy2
> constant kPiBy2String = format("%f", kPiBy2)
> local sPiMap = { "pi-by-2": kPiBy2, "pi-by-2-sq": kPiBy2Squared }
>
Very good. In fact, great !! Thank you!
Would you be ale to do something like
constant kPiMap = { ... as above ... }
And now I'll push my luck and ponder the possibility of 'global' constants.
OK - 'global constant' is likely counter to the scope concepts. But
perhaps they could be done as "write-once" variables, or as a more
general "write-protected' variable.
e.g.
(somewhere in a start-up script ...)
put 17 into gkMyMagicValue
writeprotect "gkMyMagicValue"
and any *subsequent* attempt to change the value would fail.
> P.S. Amusingly, your question came up on exactly the same day I
> 'finished' my patch for the above - it now awaits review which may
> result in it not being quite finished ;)
Yes, coincidences do happen :-)
Thanks for the explanation Mark.
Alex.
More information about the use-livecode
mailing list