Re: Inheritance and Loaded Libraries
Re: Inheritance and Loaded Libraries
- Subject: Re: Inheritance and Loaded Libraries
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 28 Oct 2004 09:19:38 -0700
On 10/28/04 6:37 AM, "has" <email@hidden> 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'. Delegation is a more powerful, flexible tool than
> inheritance for composing objects as it doesn't suffer the same
> restrictions as inheritance does, e.g. inheritance can only be used
> to compose classes whereas delegation can compose objects of any kind.
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). See pp.
331 seq. in the AppleScript Language Guide, in a chapter called "Inheritance
and Delegation". It defines inheritance (p. 331):
"Inheritance is the ability of a child script object to take on the
properties and handlers of a parent script object. You specify inheritance
with the Parent property. A script object that includes a Parent property
inherits the properties and handlers of the script object listed in the
Parent property."
Later on p. 336, it discusses delegation:
"The use of a Continue statement to call a handler in a parent script object
is called delegation. By delegating commands to a parent script object, a
child can extend the behavior of a handler contained in the parent without
having to repeat the entire handler definition. After the parent handles the
command, AppleScript continues at the place in the child where the Continue
statement was called. Handlers in child script objects that contain Continue
statements are similar to wrapper methods in object-oriented programming."
--
Paul Berkowitz
_______________________________________________
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