Re: handler failure [oops! correction]
Re: handler failure [oops! correction]
- Subject: Re: handler failure [oops! correction]
- From: Michael Terry <email@hidden>
- Date: Fri, 15 Nov 2002 04:32:21 -0800
On 11/14/02 9:03 AM, "has" <email@hidden> wrote:
>
Michael Terry wrote:
>
> 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
Watch it, dude, or I'll reveal your true name!
>
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:
I thought you were just complaining about handlers forgetting their old
context and trying to use the new context. Here, the handler's definition is
in a scope where no _val is defined, but it's called in a scope where _val
is defined. Did you want the handler to look up the value of _val in the new
scope?
Or are you complaining about AS's scoping rules?
>
======================================================================
>
>
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;
Yeah, that is really annoying. Are you saying that using 'my' to access a
parent's properties, instead of a design decision, was a cop-out to help the
compiler bind variables more easily?
>
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.
Why is this any more stupid than the last example?
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.