re. footnotes [was Re: Variable Ponderance]
re. footnotes [was Re: Variable Ponderance]
- Subject: re. footnotes [was Re: Variable Ponderance]
- From: has <email@hidden>
- Date: Fri, 1 Oct 2004 20:23:24 +0100
Michael Sullivan wrote:
Footnote: There's really only two key concepts you need to get to
understanding how AppleScript works: objects and messages.
Forenote :p - that footnote wasn't about learning how AppleScript
variables work [1], but understanding AppleScript in general (i.e.
objects and messages are the 'Big Two' concepts in AS; everything
else is mere housekeeping and occasional frippery). Apologies if its
arbitrary thread insertion caused any confusion. :)
The behavior that is described here is remarkably similar to what
happens in most lisps.
It's similar to what happens in most dynamic languages, of which Lisp
was 'simply' the first [2].
I had a really hard time wrapping my head around the idea when I
first got introduced to lisp in college, but after working with
applescript for a while, I've got used to it. Now that I've done
some lisp again, I don't mind it anymore, and can see the point to
working this way.
Lisp's central conceit is that Lisp programs are constructed using
Lisp data structures. That means Lisp programs can be built and
manipulated as easily and in exactly the same way that Lisp data can.
All the other stuff - function objects, dynamic typing, garbage
collection - has long since found its way into other languages, so I
wouldn't like to say AS is 'Lisp-inspired' as being a relative
latecomer it could have taken the same basic ideas from any number of
other languages. Its syntax, procedural semantics and
expression/statement distinction are much closer to those of
Algol-derived languages; dynamic types and garbage collection could
have just as easily and more directly arrived via Smalltalk; and it
certainly doesn'tborrow the more unique [even now] and interesting
features of Lisp. Thus comparing AS to Lisp seems to me to overrate
and overemphasise an unimportant, ill-defined and quite likely
indirect connection, and miss out on the much more important and very
direct link to Smalltalk.
I'm pretty sure that applescript actually got many of it's good
ideas (including this one) from lisp through Dylan, a lisp dialect
with more traditional (infix math, no parens) syntax that Apple did
a lot of work on in the early 90s, concurrently with a lot of
applescript development.
Could be, though again, by the time AS and Dylan came along, most of
the ideas that are traceable right back to Lisp were already present
in plenty of other languages, not least Smalltalk. Also, don't forget
that Smalltalk came from Xerox Parc - the same place as the greater
Apple Corp. got most of its good ideas from.;)
As for Dylan, it's quite frustrating to think that Apple could come
so close to finally catching up to 1958, only to be stymied at the
last moment by crass reality creeping in. (Course, you could also
blame the Lispers for squandering 40+ years' lead by sitting atop
their ivory towers proclaiming there's nothing wrong with parentheses
and who needs to play nicely with others anyway?) And now I suppose
we're stuck with several more decades of C-alikes with their crappy
type systems and lousy or non-existent macros - blech...
I'd be shocked if there wasn't some cross-pollenation there. I'd
expect most of the Dylan folks to have been familiar with Smalltalk
as well. The general idea of strong but dynamic typing is common to
both Smalltalk and Dylan, and I consider it one of the best things
about AS (though I'd like either the ability to subvert it, or a
suite of fast tools comparable to lisp's).
There are plenty modern scripting languages that have strong, dynamic
type systems these days - Python and Ruby are obvious examples, being
installed as standard on every Mac, but there's no shortage of
others. (Objective-C also supports it, if Frankensteinian systems
languages are your thing.:p) These days I don't consider
AppleScript's to be anything special. Less common are languages with
built-in coercion systems (Python, for example, insists that you
explicitly cast from one type to another), though AS's coercion
system is neither the most powerful nor the most sensible so I can't
say I've missed it all that much. One of the nice things about Dylan
is that it also allowed the programmer to optionally declare types in
their code, which can be useful both as a selective performance
optimisation in speed-critical code [3] and as a way to add some
useful additional information - and a degree of protection - to
interfaces [4].
Anyway, this is just me procrastinating cos I've got documentation to
write up today, so should really be getting on with that than
nattering here... ;)
Cheers,
has
--
[1] Variables in AppleScript are not one of its better features, btw.
[2] For more about Lisp, you could do a lot worse than start at
<http://paulgraham.com/>. Reading about Lisp won't help you
understand AppleScript any better, though it can make you realise
just how mediocre in design most programming languages actually are.
:)
[3] Though type inferencing, where the compiler deduces type
information for itself so the user doesn't have to spend all their
time clogging their code with stupid explicit type declarations, is
probably a better option still.
[4] Then again, Eiffel assertions could probably kick puny function
argument type declarations into a cocked hat.
--
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