Re: What's so great about AppleScript, anyway? (was Re: Tell Blocks Considered Harmful…)
Re: What's so great about AppleScript, anyway? (was Re: Tell Blocks Considered Harmful…)
- Subject: Re: What's so great about AppleScript, anyway? (was Re: Tell Blocks Considered Harmful…)
- From: Philip Aker <email@hidden>
- Date: Sun, 14 Dec 2008 04:01:54 -0800
On 2008-12-14, at 02:51:38, Chris Page wrote:
For the record, I think AppleScript is a pretty good language with
some great parts…
In your opinion, what are the "great parts"?
Well, I don't know how exciting this will sound to others, but some
of the things I like are:
• Very low barrier to entry. You can quickly learn to do useful
things with AppleScript without learning the whole language or all
of it's nuances.
• Very low barrier to entry. You can just open Script Editor, type
in a little script and run it without projects or build
configurations.
• Very low barrier to entry. Useful scripts can be written with very
little overhead. Despite its famous verbosity, there really isn't a
lot of semantic overhead. You don't have to write a bunch of
declarations before you write code. You don't even have to write a
single function signature, because of the implicit “run” handler.
• Very low barrier to entry. You can often read an AppleScript and
understand it well enough to know roughly what it's doing and even
successfully make small modifications without learning the whole
language.
• Supporting the previous item: The language has a certain minimum
level of verbosity, forcing scripts to have a certain degree of
readability.†
Hmm, interesting because I never put any emphasis on what you call the
low barrier to entry in these first 5 items. In fact, coming from
being a HyperCard user, I was perplexed for quite a while. But maybe
that's because I had some expectations and no stacks, cards, buttons,
etc. to graphically relate to.
• Despite its weaknesses (which I believe are addressable without
radical alterations) the English-like syntax is quite clear from a
typographical and human factors standpoint, and avoids the overuse
of language-specific arcane punctuation. Its weakness is primarily
one of ambiguity (is “path to desktop” one, two or three terms?).
Do you think this aspect could be made clearer with finer-grained
syntax coloring? In particular the separation of variables and
subroutines.
• AppleScript has syntax designed to directly express the Apple
Event Object Model.
FWIW, I think the AEOM is one of the most beautiful because queries
are expressed in its own model whereas the similar functionality in
XML has to use XPath.
Again, despite its weaknesses, I don't believe the possibly higher
precision of other languages beats being able to write:
tell application "Finder" to move (every file whose name ends with
".txt") to folder "Text Files"
Well:
mv *.txt 'Text Files'
:-) but I do know what you mean.
• It supports object-oriented, functional and procedural
programming. In my opinion good languages should support multiple
programming paradigms. Some ideas are more clearly expressed in code
using one paradigm rather than another.
• It's a high-level language, which covers a lot. Garbage collection
eliminates whole classes of errors and simplifies code. Does not
expose raw memory pointers, eliminating whole classes of errors and
simplifying code. Strong, dynamic typing eliminates whole classes of
errors and simplifies code. High-level types like string, list,
integer and real mean you don't have to worry about the byte-by-byte
format of data, and eliminates whole classes of errors (like
misinterpreting an unsigned integer as signed). These may not sound
terribly exciting these days in contrast to, say, Python, but
they're enormous wins compared to mid-level languages like Pascal,
FORTRAN, C and C++, which were the most commonly used PC programming
languages at the time AppleScript was invented.
One thing I really hope for in this area is that it could fully match
the integer types in XML Schema <http://www.w3.org/TR/xmlschema-2/#built-in-datatypes
>. It's easy to see that AS could do a good job of the majority of
the other types as well. I think it would bode well for AppleScript in
the future.
† In contrast, languages with lots of syntactical abbreviations
enable programmers to write abstruse code, whether they intend to
make it difficult for others to read or not. Reducing the amount of
typing is not a language design goal--it's a development tools goal.
Making it easier to read and write correct code is a language (and
library) design goal.
Thanks for the comments. I'm kinda surprised that your remarks are
mostly at the "high" level.
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