use-revolution Digest, Vol 11, Issue 42

Richard Gaskin ambassador at fourthworld.com
Mon Aug 9 21:11:03 EDT 2004


Matt Denton wrote:

> I guess prefacing with 'value of' causes Rev to convert 'the target' to 
> a text name value, then get the value of that object by name, which is 
> incorrect if the object has a buddy with a duplicate name.  I'll just 
> stick to 'target' and the ID of the target from here on in, value of... 
> doesn't seem to be reliable!

Just for clarity, the value function is very reliable.  It's one of the 
oldest parts of the engine, field-tested for more than a decade.

The problem here is that it's doing exactly what you're telling it to 
do, evaluating a string (the value returned by "the target"), and that 
string contains an object name which is also a reference to another 
object ("field 1").

The key is to name objects in ways that don't cause such conflicts. 
There's only two rules I can think of offhand:

- don't name an object with a purely numeric name (e.g., "12")
- don't name an object with a string that can evaluate to a
   reference to another object (e.g., naming your second
   field "field 1").

If there's a fault here it's with the IDE's default behavior for making 
up names (why not just leave the user in control?), and not with the 
underlying engine.

-- 
  Richard Gaskin
  Fourth World Media Corporation
  ___________________________________________________________
  Ambassador at FourthWorld.com       http://www.FourthWorld.com


More information about the use-livecode mailing list