Re: Finder in processes false ?
Re: Finder in processes false ?
- Subject: Re: Finder in processes false ?
- From: has <email@hidden>
- Date: Wed, 12 Oct 2005 00:22:21 +0100
Christopher Nebel wrote:
>>Anyone can show me how dumb I am for not getting why this returns "false" ?
>>
>>tell application "System Events"
>> set theProcesses to (list processes as list)
>[...]
>The more serious problem is that "list processes as list", while syntactically and semantically well-defined, doesn't do even remotely what you think it does. [1] This is about the point where Matt N. would advise you to go read a book and actually learn AppleScript instead of thinking that it's Just Like English and hoping for the best.
Indeed. However, to be fair to the OP, this is ultimately mostly AppleScript's fault for choosing a syntax that promotes high-level human readability at the cost of seriously obfuscating semantics (the underlying meaning). John Gruber gave an good example in his recent <http://daringfireball.net/2005/09/englishlikeness_monster> rant, comparing:
path of fonts folder of user domain
to:
path to fonts folder from user domain
Two expressions that have very similar syntax but very different semantics. A language with conventional Algol-ish syntax would use something like:
user_domain.fonts_folder.path
and
path_to(#fonts_folder, from=#user_domain)
Not as pretty, and hard to make any kind of sense of if you don't already understand what all those additional cryptic-looking symbols mean. However, it does have the big advantage that the semantics of each expression are completely explicit: it's immediately obvious from the source code alone what's a command, what's an argument name, what's a property, what's an enumeration; no expert knowledge of hundreds of language/osax/application-installed keywords required to reach the same conclusion.
(BTW, this is why I think completely dropping dialects was a big loss, if not outright mistake. While foreign language dialects may have been impractical, the ability to switch between conventional English and an alternative Algol-style syntax would have provided users with the best of both worlds: high-level grokability from the former, semantic clarity from the latter.)
A modest solution would be to improve AS's pretty printer so it uses different styles to distinguish between commands, properties, elements, types and enums, rather than using a single style for all as it currently does. If anyone wants to file a feature request to that effect then be my guest.
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