[Tip] Propeties & sets & List of 'reserved words' and gotchas

John Vokey vokey at uleth.ca
Mon Feb 20 23:59:35 EST 2006


Stephen and Trevor,

   This is a long-standing complaint of mine about custom properties  
in MC/RR (please see the archives), which has usually received at  
best irrelevant responses, if any at all (the most common response).   
IMHO, for consistency, *all* custom properties should be quoted (when  
the literal is meant), or taken as the value of the unquoted term  
when not.  So,

put "mary" into fred
set the fred of this stack to x
-- means set the property "mary" of this stack to the value of x
-- and works just this way in MC/RR, which is as it should be.
-- But only
-- if fred does not already exist as a custom property.
-- However, I now ask you what would you predict should happen if
-- 1. fred already exists as a custom property and fred (the variable)
--    has the value ``mary''? (i.e., add this line before the other two:
--    set the fred of this stack to "fred"
-- 2. fred already exists as a custom property, but fred (the variable)
--    does not exist?  Exists, but is empty?  Exists, but evaluates  
to "Jane"?
-- Try them: you may (should) be surprised.

The only other consistent alternative, so that unquoted property  
names behave consistently, is to deny the use of variables as  
property names in custom property statements, as function and  
procedure names are currently handled---not an option I would  
support, btw.


On 20-Feb-06, at 7:09 PM, use-revolution-request at lists.runrev.com wrote:

> Stephen,
>
> You can reliably use reserved words with array notation as long as
> you have quotes around the key (I've never tried without quotes
> actually).
>
> I use code like this all of the time:
>
> set the uAutoEvents["MouseUp"] of myObject to "DoSomething"
>
> Perhaps it is the lack of quotes that is causing problems?
>
> -- 
> Trevor DeVore

--
Please avoid sending me Word or PowerPoint attachments.
See <http://www.gnu.org/philosophy/no-word-attachments.html>

-Dr. John R. Vokey






More information about the use-livecode mailing list