Re: Tell Blocks Considered Harmful (was Re: open for access)
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: Wed, 10 Dec 2008 01:46:45 -0800
On 2008-12-09, at 18:25:18, Chris Page wrote: On Dec 3, 2008, at 3:33 AM, Philip Aker wrote: associate fndr with provider "com.apple.finder" associate stadds with provider "com.apple.osax.standardadditions"
tell fndr tell stadds set f to open for access hfspath -- code hunk end tell end tell
Or, probably in most cases:
associate fndr with provider "com.apple.finder" associate stadds with provider "com.apple.osax.standardadditions"
tell stadds to set f to open for access hfspath tell fndr -- code hunk that tells Finder to do something with the file end tell -- code hunk that has nothing whatsoever to do with Finder, but may also use the file
i.e., even with “associate … with” it would be best to avoid placing things inside tell blocks unnecessarily.
Ok and yes, but my intent is to solve AppleScript's symbol addressing problem such that calls to other terminology providers within a 'tell application' block can be made unambiguously. What I'm trying to illustrate is an upgrade to 'tell application "XXX"' such that the terminology association and interpretation is associated to the bundle id rather than the application name (tell bundle id "XXX"). This would allow suitable code hunks such as osaxen to participate. Perhaps it would be too much to have to bind terminology providers at the top level of a script (as you are doing above) however it would bring a certain amount of clarity to the language. It's the norm in other languages such as Perl, Python, Ruby, and Tcl to use import-like calls at the top level of their scripts.
Binding identifiers as above would imply a URI (somewhat similar to XML namespaces) with the default items being the pre-loaded providers on the local machine. With an eye to even greater usefulness sometime in the future (e.g. iPhone), it might be possible to devise a load-and-bind form:
Thanks for listening,
Philip Aker
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