Re: handler failure [oops! correction]
Re: handler failure [oops! correction]
- Subject: Re: handler failure [oops! correction]
- From: Paul Skinner <email@hidden>
- Date: Wed, 13 Nov 2002 22:41:34 -0500
On Wednesday, November 13, 2002, at 02:40 PM, has wrote:
Paul Skinner wrote:
set b's bar to a's foo
b's bar
--> <<handler foo>> --!!!!!
[...]
It looks to me like you meant to ...
Awww, shit.
Sorry, but I screwed up that sample code completely. (A typo, made in
haste
when retyping from memory after bloody Eudora ate my original post.)
Here's a fixed version. (I've also taken the liberty of adjusting the
code,
to make it a little easier for you to see what's going wrong.)
======================================================================
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.)
has (class idiot since 1971)
--
http://www.barple.pwp.blueyonder.co.uk -- The Little Page of
AppleScripts
That is better. But the problem is the same. Your foo handler needs a
value it can't get. Yes, AppleScript gives it something different
without complaining ( the property whose index matches) and that is a
bug.
script a
property _val : 1
on foo()
return _val of a
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()
-->1
In my opinion this is not a good idea. The foo handler requires an
external property to function properly. Personally, I think that
handlers that contain external resources like the one above should be
passed around in a script object.
It makes me wonder what kind of clever trick you were pursuing when
you first did this. Dynamically modifiable handlers? Self replicating,
artificially intelligent handlers? Cold fusion? : )
--
Paul Skinner
_______________________________________________
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.