Re: script object property contamination [reckon I've sussed it
Re: script object property contamination [reckon I've sussed it
- Subject: Re: script object property contamination [reckon I've sussed it
- From: Nigel Garvey <email@hidden>
- Date: Mon, 11 Feb 2002 13:47:44 +0000
has wrote on Sun, 10 Feb 2002 19:00:15 +0000:
>
<wild supposition>
>
>
I'd guess that [script] object names are
>
stored as a hash, and that pointers to the objects themselves are stored in
>
a simple indexed table.
[...]
>
That means the runtime engine only has to do a quick table lookup and
>
follow a pointer to retrieve an object (steps 2 and 3) instead of having to
>
do a full name-based lookup (steps 1 thru 3).
>
>
</wild supposition>
>
script scriptOne
>
property frank : "Frank"
>
>
property handlerStore : {}
>
>
end script
>
>
>
script scriptTwo
>
property bob : "Bob"
>
>
on getBob()
>
get bob
>
end getBob
>
>
end script
>
>
--TEST 1
>
tell scriptTwo to getBob()
>
--> "Bob" (as you'd expect)
>
>
>
--TEST 2
>
set scriptOne's handlerStore to scriptTwo's getBob
>
>
tell scriptOne to handlerStore()
>
--> "Frank" (note: this is wrong; it should've given an error because there
>
isn't a 'bob' in scriptOne)
has's theory is born out by the fact that if you insert a 'property bob :
"Bob"' before frank in scriptOne, "Bob" is what's returned by TEST 2. If
instead you insert bob after frank, "Frank" is returned as above.
Similarly, if you instead insert a property before bob in scriptTwo, so
that bob is now the second property in that script and there's only frank
and handlerStore in scriptOne, the result of running TEST 2 is <<handler
getBob>>.
Whether you'd call this a bug (something unexpected at first glance), or
the natural result of transposing a handler compiled in one script into
another script, is a moot point.
NG
_______________________________________________
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.