• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Object inheritance question...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Object inheritance question...


  • Subject: Re: Object inheritance question...
  • From: has <email@hidden>
  • Date: Wed, 28 Sep 2005 09:56:36 +0100

Mark J. Reed wrote:

> > but there isn't really any OOP going on here at
> > all because there are not really classes (despite the use of the term
> > "class" as a property name).
>
>What you're describing sounds like prototype-based inheritance rather
>than class-based inheritance.  It's not the usual O-O paradigm, but
>it's very much a valid one, and certainly qualifies as "object
>oriented".

What Mark said. See <http://en.wikipedia.org/wiki/Prototype-based_programming>; AS falls under the 'pure prototyping' category. (Warning: the term 'parent' has a completely different meaning on that page to how AS uses it; in AS it means an object's delegate, whereas there it refers to the object from which it was cloned. Don't let that confuse you.)

One further wrinkle to AS OOP: using AS's 'copy' command to clone script objects is generally a bad idea as it performs a deep copy of the object and all its parents (which usually includes the top-level script and everything in it), which is very expensive and wreaks havoc with any carefully shared state. Stick to using constructor functions to create new script objects, unless you're really sure a deep copy is what you want.

HTH

has
--
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

  • Prev by Date: Re: Records
  • Next by Date: Re: multiple text delimiters
  • Previous by thread: Re: Object inheritance question...
  • Next by thread: "Choose file" bug?
  • Index(es):
    • Date
    • Thread