• 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: Tell Blocks Considered Harmful (was Re: open for access)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tell Blocks Considered Harmful (was Re: open for access)


  • Subject: Re: Tell Blocks Considered Harmful (was Re: open for access)
  • From: Philip Aker <email@hidden>
  • Date: Fri, 12 Dec 2008 05:03:38 -0800

On 2008-12-11, at 14:45:47, has wrote:

Well, I think you misinterpreted my lousy illustration :-). It was intended to show how "terminology providers" will be an upgrade to 'tell application "XXX"' not how to upgrade the existing facility.

It's not clear what you mean by 'terminology providers', 

You can review the concept starting at <http://lists.apple.com/archives/applescript-users/2008/Dec/msg00037.html>.

It's been established that the concept is understood by the person to whom it was meant to be communicated. 

I'm not sure a further explanation would serve any purpose since you've waxed on at length about a concept you're not clear on but somehow ideologically opposed to.

Except to say that the XML-like binding method I sketched would also be a viable means to implement the "fine-grained namespace control" (mentioned in <http://lists.apple.com/archives/applescript-users/2008/Dec/msg00157.html>) AppleScript could really use.

In my opinion, the only thing left to consider is the form AppleScript namespaces should take. That is to say if the namespace delimiter was a C++ like double-colon, the following three lines:

associate md with provider "ca.aker.osaxen.MetaData http://www.aker.ca/osaxen/MetaData.osax/"

tell md
query search_term in directories dirs reporting {kMDItemPath, kMDItemFSFinderFlags})
end tell

could be reduced to one line and expressed as:
md::query search_term in directories dirs reporting {kMDItemPath, kMDItemFSFinderFlags}) 

However, I think it best if other namespace forms be explored in case they might offer more functionality or expedience to the language.  I currently don't know of any other radically different notion.

Philip


or what problem it's meant to solve that isn't covered already.



If you want to specify terminology at compile-time, wrap your code in a 'using terms from' block. If you want to specify terminology and a default target for commands, use a 'tell application ...' block with the application name or bundle id supplied as a literal so that the compiler can read it at compile-time. If you want to specify a default target only, use a 'tell ...' block with anything other than a literal application specifier as the target.

Right now this only works for applications, not for idiologically; if the same approach was to be applied to osaxen then the language would need something like a 'scripting addition' specifier (although, as mentioned before, changing osax scoping rules now would likely cause more problems than it'd solve).


So a "terminology provider" (assuming it subscribed to the required protocols) wouldn't necessarily be limited to the application or osax packages currently used because if the nature of a package can be determined, the means to load/activate it can also.

A one-size-fits-all syntax doesn't really win you anything. Someone still needs to implement code for connecting to each class of supplier (application, osax, etc), and in practice that's going to be Apple who can easily matching object specifiers in the language while they're at it. Having different specifier names for different classes of suppliers is also preferable for users as it makes the code more descriptive and therefore easier to understand.

The only other thing your examples add are an unintuitive phrasing and extra indirection, neither of which you want in a language like AppleScript given its target audience. A statement such as:

tell application "Finder" to get name of home

may not satisfy the purists, but it's more than adequate for most AppleScripters to get started with and easy to understand. It's certainly simpler for novices to read than:

tell application id "com.apple.finder" to get name of home

while most would be put off by the much more cryptic:

associate fndr with provider "com.apple.finder"
...
tell fndr to get name of home


What could (and should) happen though is that the task of loading and invoking osax handlers should be moved out of processes and into the AppleScript component itself (which is where it should've been in the first place). Allowing the arbitrary loading of arbitrary code into arbitrary [1] processes just isn't a very good idea, and Apple are already in the process of locking down that sort of behaviour elsewhere (c.f. Input Managers).

It seems to me that the above implies some curtailment of dynamism and therefore not advantageous.

Moving osax handlers out of processes and into the AS component doesn't curtail AppleScript's dynamism. It does prevent non-AppleScript clients using them, but it's not like they'd be missing much. More importantly, it would plug another potential hole in the system. If osaxen had been implemented as language extensions from the get-go Apple wouldn't have had to plug an embarrassing osax-based security flaw in their OS a couple months back, and users running AppleScripts within privileged processes wouldn't now find their scripts unable to load any osaxen at all.


Beyond that, there isn't really much point trying to invent clever, sophisticated import mechanisms for AppleScript. They're unlikely to justify their development costs as the language just isn't that good or widely used, and it creates more complexity for users, most of whom aren't professional programmers and will benefit more from simplicity and clarity and the reuse of existing mechanisms.

Regards,

has

Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@

Democracy: Two wolves and a sheep voting on lunch.

 _______________________________________________
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: Tell Blocks Considered Harmful (was Re: open for access)
      • From: has <email@hidden>
References: 
 >Re: Tell Blocks Considered Harmful (was Re: open for access) (From: has <email@hidden>)
 >Re: Tell Blocks Considered Harmful (was Re: open for access) (From: Philip Aker <email@hidden>)
 >Re: Tell Blocks Considered Harmful (was Re: open for access) (From: has <email@hidden>)

  • Prev by Date: Finder: 'clipping window'
  • Next by Date: Re: Code Signing.
  • Previous by thread: Re: Tell Blocks Considered Harmful (was Re: open for access)
  • Next by thread: Re: Tell Blocks Considered Harmful (was Re: open for access)
  • Index(es):
    • Date
    • Thread