Re: handler failure [oops! correction]
Re: handler failure [oops! correction]
- Subject: Re: handler failure [oops! correction]
- From: has <email@hidden>
- Date: Thu, 14 Nov 2002 17:03:53 +0000
Michael Terry wrote:
>
OK, has, I'll play your little game.
Oh goody, we likeses little gameses. ;)
>
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.
Darn, I must be making them too easy. ;p
Here's a tougher one: how to remedy the problem?
The only solution I can think of is making the compiler much more sparing
(or far more intelligent) in what and how it binds at compile-time.
I've noticed several other variable binding problems with AS, including this:
======================================================================
on foo()
return _val
end foo
property _val : 1
foo()
======================================================================
which is very bad; and this:
======================================================================
script a
property _val : 1
end script
script b
property parent : a
on foo()
return _val
end foo
end script
b's foo()
======================================================================
which is a perennial annoyance; and this:
======================================================================
script a
property _val : 1
end script
script c
property _val : false
script b
property parent : a
on foo()
return _val
end foo
end script
end script
c's b's foo()
======================================================================
which is downright stupid.
At the end of the day though, maybe static bindings are just a Bad Idea in
a language as dynamic as AS. Wonder what the performance penalty would be
if static bindings were just dropped altogether?
No easy answer, I suspect.
has
p.s. Anyone ever tried Sun's Self language? Very similar to AS in this
department (i.e. prototype-, slot-based), but with a purer implementation
(messages for everything, including getting/setting state). Just curious.
--
http://www.barple.pwp.blueyonder.co.uk -- The Little Page of AppleScripts
_______________________________________________
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.