• 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: Why these errors?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why these errors?


  • Subject: Re: Why these errors?
  • From: 2551 <email@hidden>
  • Date: Mon, 10 Feb 2014 19:53:57 +0700

On 10 Feb 2014, at 01:46, Christian Boyce <email@hidden> wrote:

I would have guessed that if the Finder doesn't know anything about the function/handler "convert_the_file" AppleScript would-- by default-- look "up a level"

Objective-C does this, but AppleScript isn't a true 'object-orientated' programming language, not least because its nature - to be an inter-application metalanguage rather than an application development language - doesn't lend itself to inheritance of class behaviour.

Think about it this way: AS is a means for independently developed apps that know nothing about each other to communicate. Sure, Apple could build into all there own homegrown apps recognition of handers with 'somestring()' syntax, but what happens when developer XYZ of app ABC; doesn't bother to implement that? Then in some cases your script will look up the hierarchy tree and in others it won't, depending on which apps you are targeting. Now consider another problem: what happens when two independent developers both create handlers with identical names? What if you want to target one in the parent script object while you're inside the tell block of the other? 

The ‘my’ keyword elegantly solves these kinds of problems; you can force the script to look outside the immediate scope only when you want it to, and no matter what app is being targeted or how the developer has implemented their app’s scriptability.

Best

Phil

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Why these errors?
      • From: Jon Pugh <email@hidden>
References: 
 >Why these errors? (From: Christian Boyce <email@hidden>)
 >Re: Why these errors? (From: 2551 <email@hidden>)
 >Re: Why these errors? (From: Christian Boyce <email@hidden>)

  • Prev by Date: applescript and mail
  • Next by Date: Resource folder of library script?
  • Previous by thread: Re: Why these errors?
  • Next by thread: Re: Why these errors?
  • Index(es):
    • Date
    • Thread