Re: Inheritance and Loaded Libraries
Re: Inheritance and Loaded Libraries
- Subject: Re: Inheritance and Loaded Libraries
- From: has <email@hidden>
- Date: Thu, 28 Oct 2004 21:40:06 +0100
Paul Berkowitz wrote:
> A script's parent property can hold any type of object. When a script
object receives a command it doesn't understand, it forwards that
command to the object stored in its parent property. This is called
> 'delegation'.
I'm sure you're right. But AppleScript refers to it as "inheritance", even
if it shouldn't according to object-oriented languages (or you).
I know, and it's misleading. With inheritance-based composition, the
attributes defined in each class are all squidged together to define
a new kind of object. Individual objects can then be created using
that definition. With delegation-based composition, individual
objects that are already in existence are linked together as a chain,
allowing messages to pass automatically up and down that chain. None
of this smooshing things together nonsense; each object retains its
own identity. I suspected your 'only script or AppleScript objects
can be parents' hypothesis might have been formed due to believing it
was an inheritance-based relationship (where it would make sense),
hence the explanation of what's actually going on by way of
clarification.
The ASLG's 'creative' explanation may have been used for
familiarity's sake, since AppleScripters would already understand the
concept of inheritance from application scripting. But I can say from
experience that this is one subject where the honest explanation
actually turns out to be far simpler and easier to understand that
any 'helpfully fictionalised' version. Some knowledge is just better
left 'untransferred'. :)
Cheers,
has
p.s. Incidentally, since inheritance and delegation are two
independent things, you'll sometimes meet languages that use both,
such as Smalltalk and its red-headed stepchild, Objective-C. Another
good reason to be clear on what the difference is, else you could do
yourself a right injury some day. ;)
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
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