Naming Custom Properties

Dave Cragg dave.cragg at lacscentre.co.uk
Sat Apr 17 04:41:57 EDT 2010


On 17 Apr 2010, at 00:39, Vokey, John wrote:
> set the "fred" of this stack to myArray
>  put "fred" into mary; set the mary of this stack to myArray
> 
> do the same thing.  The line
> 
>  set the fred of this stack to myArray
> 
> should throw an error if fred is empty.  Unfortunately, nobody at RunRev seems to agree with my desire for a consistent syntax.

Some history from my woolly memory.

I think that at one time, you couldn't set a custom property using a variable. (Some time before Metacard 2.5)

So the following...

   put "mary" into fred
   set the fred of me to "abc"

would have created a property named "fred".

The decision to allow using variables was to support the then fledgling Revolution IDE (Before RunRev acquired the Metacard engine). The case was made that this really speeded up the "massive setting of properties", which is what the Rev IDE does at times. Scott Raney was aware of potential problems and asked on the list whether there were any strong objections to the change. I think the general opinion was that the benefits outweighed the problems. I tend to agree, and have made frequent use of this feature. (Previously you had to construct ugly "do" statements to convert the variable contents to the property name.)

I understand the logic behind your idea for requiring custom property names to be quoted. But it would create an oddity where built-in properties would not require quotes and custom properties would. 

   set the height of me to 123
   set the "cHeight" of me to 456

It would presumably break many existing stacks too.

Overall, I think I prefer the current behavior.


Cheers
Dave


More information about the use-livecode mailing list