Re: handler failure [oops! correction]
Re: handler failure [oops! correction]
- Subject: Re: handler failure [oops! correction]
- From: Michael Terry <email@hidden>
- Date: Wed, 13 Nov 2002 14:41:02 -0800
On 11/13/02 11:40 AM, "has" <email@hidden> wrote:
>
script a
>
property _val : 1
>
>
on foo()
>
return _val
>
end foo
>
end script
>
>
script b
>
property _thing : "hello"
>
>
property bar : missing value
>
end script
>
>
a's foo()
>
--> 1
>
>
set b's bar to a's foo
>
b's bar()
>
--> "hello" --!!!!!
>
>
======================================================================
>
>
As you can see, the result is completely crack-addled. (I know what's going
>
wrong here, but let's see who else can figure it out.)
OK, has, I'll play your little game. It looks to me like property
identifiers are linked to their values by a number index at compile time. A
separate index is created for each scope. If a handler moves into a new
scope and references a property, there's a problem. It tries to look up its
property's value in the new index using the index number it was given for
the old index at compile time. Results are even less comprehensible than
above if the index number refers to a position in the new index which
doesn't exist.
Examples:
------------------------
script a
property _val : 1
property _anotherVal : 2
property _moreVal : 3
on foo()
return _val
end foo
end script
script b
property bar : missing value
property _1 : "Hello"
end script
set b's bar to a's foo
b's bar()
--> <<handler foo>>
-------------------------
-------------------------
script a
property _val : 1
property _anotherVal : 2
property _moreVal : 3
on foo()
return _anotherVal
end foo
end script
script b
property bar : missing value
property _1 : "Hello"
end script
set b's bar to a's foo
b's bar()
--> "Hello"
-------------------------
-------------------------
script a
property _val : 1
property _anotherVal : 2
property _moreVal : 3
on foo()
return _anotherVal
end foo
end script
script b
property bar : missing value
end script
set b's bar to a's foo
b's bar()
--> 48
-------------------------
-------------------------
script a
property _val : 1
property _anotherVal : 2
property _moreVal : 3
on foo()
return _moreVal
end foo
end script
script b
property bar : missing value
end script
set b's bar to a's foo
b's bar()
--> 16414
-------------------------
Mike
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.