Understanding the long ID?
Richard Gaskin
ambassador at fourthworld.com
Tue May 15 19:44:26 EDT 2007
Mark Talluto wrote:
> On May 15, 2007, at 3:55 PM, Chipp Walters wrote:
>> I'm using the latest release of Rev 2.8.1
>> I create a new stack, add a single fld and a single button. In the
>> button script I add:
>>
>> on mouseUp
>> put the long ID of fld 1 into tID
>> set the disabled of tID to not the disabled of tID
>> put "fred" into tID
>> end mouseUp
>>
>> When I press it, the field becomes disabled alternately (as
>> expected). The disabled is only here to show that tID is
>> referenced correctly.
>>
>> But, "fred" never gets put in the field? I wonder why? Is this a bug?
>>
>> BTW, this does work:
>>
>> set the text of tID to "fred"
>
>
> I think it is a bug.
If Rev variables were types and tID was typed as an object reference it
might be a bug.
But as it is, Rev vars are just buckets into which you can put anything
you want. One minute you can store a string that refers to an object,
the next minute you can store some arbitrary text -- how is Rev to know
you mean otherwise?
Rev vars don't have properties, but objects do, so when you say:
set the text of tID to "fred"
...it knows that you're setting a property so it first evaluates tID to
get the object reference, then sets that object's property.
The ambiguity is -- once again -- HyperCard compatibility. In most
languages, properties are set in a consistent way, and in Rev the text
property can be set using "set the text of...".
But HyperCard allowed the convenience of setting the text property
without having to name the property by using "put <val> into <obj>".
While it's convenient to treat the text property of objects as an
implied container, the ambiguity inherent in HyperTalk's design has led
to a great many confusing moments for many people over the last couple
decades.
--
Richard Gaskin
Fourth World Media Corporation
___________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the use-livecode
mailing list