Re: AppleScript and shell scripting
Re: AppleScript and shell scripting
- Subject: Re: AppleScript and shell scripting
- From: has <email@hidden>
- Date: Tue, 31 Jul 2007 22:23:59 +0100
Ed Stockly wrote:
Sometimes the reason that folk are facing a roadblock isn't
because they're
having trouble understanding the language, it's because the
language makes it
unnecessarily difficult to do what it is they want to do.
Efficient scripting for me is what can I write that is easy to
understand,
others can understand, that I know I will be able to figure it out
after not
looking at it for three years, when I want to rework it, and that
it works.
And if it takes a few extra ticks or seconds to finish, I'll pay
that price.
If it takes 10 times as many keystrokes, that doesn't bother me.
Hey, if that's what floats your own personal boat then more power to
you. The point being made by others is that not everybody else shares
your particular set of preferences and priorities, and the content of
this list reflects that. If a particular discussion doesn't interest
you, you're welcome to ignore it; same applies to everyone else here.
If AppleScript wasn't such a grossly deficient language, you
wouldn't get
nearly as many folk resorting to shell scripting as a workaround
to its
inadequacies in the first place.
If AppleScript were so grossly deficient as you suggest there
wouldn't be
that many people using it to begin with.
AppleScript's success is based on three things: 1. it's been included
as standard since OS 7.5; 2. it was for years the only free language
available with really good application scripting support; 3. the
English-like syntax attracts certain groups of users who are put off
by more traditional languages.
Unless we're all doing things wrong and just don't know any better.
There is nothing inherently wrong with doing things wrong and/or not
knowing any better. That's what learning's for. You're the one
arguing that learners shouldn't be exposed to any ideas or tools
outwith the narrow range of those you are personally comfortable with.
The language is neither fine nor robust. It lacks even the most
basic of
functionality that other languages provide as standard - a decent
collection of
text, list, math and filesystem commands, built-in hash and file
types, and
formal native extension mechanisms for adding your own - while
known bugs and
deficiencies (e.g. buggy list-to-Unicode-text coercions, O(n) list
access)
persist for year after year.
First, these are completely subjective complaints, and as such, my
responses
are also subjective.
"Completely subjective" my foot. These and other long-standing
deficiencies are responsible for a significant portion of "how do I
do this?" traffic on this and other forums over the years. Basic,
basic tasks that the language should cover as standard, or at least
allow standardised third-party implementations to be provided. I've
personally responded to such requests often enough that I long ago
lost count. I've even attempted to establish a standard library to
fill some of these gaps, but with the AppleScript language
steadfastly refusing to help here it's never managed to find popular
traction. And I'm far from the only one here.
How do you think languages like Perl, Python, Ruby, etc. have managed
to become far more powerful and successful than AppleScript in
roughly the same length of time? One, because they laid a solid
foundation to get users started with, and two, because they provided
the rich extension mechanisms that allow early users to build on that
initial foundation, and later waves of users to build on the work of
their predecessors, and so on.
Those languages thrive because they allow newcomers to stand on the
shoulders of giants, to paraphrase Sir Issac Newton, rather than
scrabble in the dirt like their fathers and forefathers before them,
as is sadly all too often the situation with AppleScript.
Second, it seems that in your comparisons anything that's not the
absolute
best, most effective and efficient tool for a particular task is
"lousy" or
isn't "decent."
I'm pretty happy with AppleScript's text manipulations. So much so
that I
never replaced the XML file parcer I wrote in Vanilla AppleScript
years ago.
Sorry, but anyone who thinks they know how to write an XML parser
almost by definition doesn't. Have you ever read the XML standard?
I've written HTML and Plist parsers in vanilla AppleScript, and I
_know_ they're just toy code and hardly appropriate for real-world
use. Any idiot can write toy code; that's no excuse for trying to
foist toy code on everybody else. Some people have real-world XML to
digest, and better things to do than spend 5 years learning to write
their own industrial-strength XML parsers to do so. That's what code
reuse is all about: getting more knowledgeable and experienced people
to do as much of the hard/tedious/repetitive dogwork as possible so
that you don't have to.
Writing such toy code yourself can be fun and a useful learning
experience, but it's not stuff you should ever want to use yourself
(unless you're an egotist, a fool or utterly desperate). Suggesting
that you consider such code quite sufficient merely reinforces my
impression that, despite your claims to broader experience, your
arguments are really just coming from ignorance.
The list functions could be improved, but with a few pure AppleScript
handlers they can be pretty useful.
What, like that POS "ASCII sort" routine I still see peddled around
on a regular basis? It's not that folks haven't written far better
implementations, it's that there's no mechanism for making those good
implementations the de-facto standard.
I'm perfectly happy, more than happy, with the file system commands.
Peachy for you. Again, not everyone else is you.
Nor what you mean about "formal native extension mechanisms" are OSAX
informal?
OSAXen are the poor-man's extension mechanism - a quick-n-dirty hack
bolted on as an afterthought that, due to circumstance, never got
replaced by something better. If you knew more about the technical
nuts and bolts behind AppleScript, you'd know why they're a rotten
substitute for a native C-based extension API.
(In which case the Library feature has been built into the language
from the beginning).
I'm sorry, but please don't call Standard Additions' 'load script'
command a 'Library feature'. You might as well paint speed stripes on
a wheelbarrow and call it a Ferarri. Some of us have actually used
languages that have real library systems (or even developed our own).
If you'd spent any serious time using CPAN or similar you'd know why
it's no alternative at all to a native AppleScript-based extension
API. When AppleScript has a thriving "mini-CPAN" of fifty or more
mature, robust, useful third-party libraries available for all to
use, you let me know, m'kay?
I've got a feeling this is something very few AppleScripters care
that much
about.
Very few truly new AppleScripters care that much because they don't
yet know enough to be aware of what they're being deprived of. It's
the older, battle-hardened AppleScripters who begin to realise that
things aren't as good as they could or should be, and the folk coming
to AppleScript from other, better languages and immediately realise
things aren't right, who get annoyed, frustrated, and eventually
haemorrhage to other platforms, all to the permanent loss of
AppleScript and its community as a whole.
OTOH, if you're repeatedly peddling an inferior solution out of
religious
zealotry or willful ignorance, you can expect to be whomped
increasingly hard
with the clue stick and eventually plonked as a troll.
Lucky for you shell scripting evangelists, the AppleScript users
list is a
much friendlier place!
When the shell scripters here start peddling inferior solutions out
of religious zealotry or willful ignorance, you'll be welcome to
insult them freely - and I'm sure I and others will be happy to join
in. Until then, take care not to trip over the beam in your own eye.
Bowing out of this discussion now, as I have other things to be
getting on with. (Such as shipping the Ruby appscript beta, woot!!!)
Regards,
has
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org
http://appscript.sourceforge.net/objc-appscript.html
_______________________________________________
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