Re: Script Objects - help please!!
Re: Script Objects - help please!!
- Subject: Re: Script Objects - help please!!
- From: Simon Forster <email@hidden>
- Date: Mon, 13 Jun 2005 08:38:20 +0100
On 12 Jun 2005, at 22:12, has wrote:
Dynamic lookup starts at the currently targetted script object and
searches along its inheritance chain until it finds the desired
variable (or runs out of places to look). Example:
script Foo
property x : 1
property y : 2
on getX()
return x -- permanently bound to Foo's property x at
compile-time
end getX
on getY()
return my y -- looked up at runtime, starting with original
recipient of getY message
end getY
end script
script Bar
property parent : Foo
property x : 10
property y : 20
end script
tell Bar to {getX(), getY()} --> {1, 20}
(Overriding properties is bad design, mind; the above example is
merely to demonstrate the differences in how lexical vs dynamic
binding works.)
Is this likely to come back and bite me? Should I just go through
my library script and delete all these unnecessary "of me"s? (A
bit of a shot in the dark for you without seeing the entire
context but I'd like to hear your opinion).
I doubt it will make a difference in your case. Though as a general
principle of good design, one should avoid unnecessary code.
If you're curious to see practical examples of library and OO
design, check out AppleMods' libraries <http://
applemods.sourceforge.net/>; some interesting stuff there. e.g. The
Types library has some good basic OO code in it.
Thanks for the info - got it sorted now. I've downloaded the Types
library, had a look through it and stored it for future ref.
What can I say... except thank you for your patience and guidance.
ATB
Simon Forster
_____________________________________________________
LDML Ltd, 62 Pall Mall, London, SW1Y 5HZ, UK
Tel: +44 (0)70 9230 5244 Fax: +44 (0)70 9230 5247
_____________________________________________________
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden