Re: AppleScript and shell scripting
Re: AppleScript and shell scripting
- Subject: Re: AppleScript and shell scripting
- From: has <email@hidden>
- Date: Mon, 30 Jul 2007 22:03:40 +0100
Ed Stockly wrote:
Since you asked (and since you seem to dismiss all my concerns as
some kind of syntax phobia):
Certainly not; I'm sure there are multiple reasons for your own
hostility.
Have I been hostile?
That's hostility towards non-"pure AppleScript" solutions, just to
clarify.
I think it borders on the patronising to say they shouldn't be
exposed to it, as if they're not capable of understanding or
asking for help to understand.
At the very least, when they come to the AppleScript list, they
should get AppleScript solutions.
I think it's patronizing and counter productive to be told:
Rather than answer your question I'm going to tell you to learn
Python or Perl or Automator or whatever other technology. I'm not
saying there is no place for that at all on this list, but if someone
is struggling with the language, at least help them get past whatever
roadblock their facing is more important than promoting your pet
technology.
There are two reasons why a non-AppleScript solution may be proposed
in response for a request for help:
1. The poster wants to promote their own pet solution/preference for
its own sake, regardless of whether or not it's the most appropriate
choice of the task. This is not something I agree with either;
fortunately, I don't think it happens that much in practice, at least
where non-AppleScript solutions are concerned. (OTOH, pushing "pure
AppleScript" solutions where a non-AppleScript or hybrid solution
would be more effective...;)
2. The poster knows from experience that the problem being presented
is one that's easily and efficiently solved using a non-AppleScript
solution while the equivalent AppleScript solution is complicated,
slow, hackish, buggy and/or otherwise wanting.
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. Effective, efficient scripting is all about pragmatism and
doing the simplest thing that works. Religious arguments about
language purity are best taken to alt.foo.advocacy where those that
care can debate the issue till the cows come home; the rest just want
to get the job done and move on to the next one as lazily and
speedily as possible.
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.
It's not the language that's deficient. They language is fine,
robust.
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.
The problem is the lack of support, because it's an
application scripting language it needs support from Apple and other
developers.
In other words, the language is grossly deficient.
If you have a problem with this, do something about addressing
those deficiencies yourself rather than complaining about other
folks' solutions.
In the past I had a blog (justapplescript.manilla.com) and a web site
(applescriptpro.com) On the blog I had a comprehensive guide to
appleScript training
resources.
Training resources are good. OTOH, they're not a remedy to the
fundamental problem of missing or inadequate functionality, which is
the issue here. If you care about missing or inadequate
functionality, develop an AppleScript add-on to fill that hole.
When macscripter.net started an appleScript blog, I stopped. Now
they've stopped blogging.
This is getting OT, but MacScripter's daily news feed was a great
feature, much missed. If you enjoy blogging about developments in the
AppleScript world, perhaps you might consider volunteering?
How does isolating AppleScript and its community from the larger
scripting world encourage it to thrive? Sounds more like a recipe for
further ghettoization to me - as if AppleScript isn't ghettoized
enough already.
I'm just curious, if I were to go on a python list or a perl list and
constantly answer questions with "Here's how to do it in appleScript"
and throw in a sales pitch for appleScript how would that go over?
That depends. If AppleScript is the best solution for the job then I
would expect your input would be welcomed. While you may occasionally
get the odd elitist twit, most of tho folks who use these languages
are practical sorts and aware that their platform of preference isn't
the best choice for every kind of task.
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.
Of course, this can be done with GUI AppleScript
Even though I loved Prefab's Player, and got it to do some very
useful thing back in OS 9 days, it was still a patch for inadequate
support. Many years later and I usually need to wash my hands in
bleach after implementing a GUI solution in AppleScript. It's even
uglier than it was with Player. We shouldn't have to do that for
software that Apple ships. It's just another bit of evidence that
they don't care about AppleScript.
In this case GUI scripting resolved the problem, without shell
scripting, I might add.
Whatever the faults of shell scripting, GUI scripting is a hundred
times worse. Convoluted, opaque, fragile as hell, and just plain
evil, it should only be viewed and used as a last resort. While Apple
are right to provide it as there are occasions where it may be
inescapable and a last-ditch option is better than none, if you care
about AppleScript at all it's the last thing you should want to
promote as it flies in the face of everything that AppleScript stands
for.
Maybe if there were more AppleScripters AppleScript would have a
higher priority.
Maybe if there were more Perl monks, Pythonistas, Rubyists, shell
weenies and Cocoa heads wanting to do application scripting,
application scripting technologies in general would have a higher
priority. Did I mention the benefits of embracing the melting pot
instead of trying to avoid it?
Here's a good technical reason: AppleScript is good at application
scripting and lousy at everything else.
HEllO NEWBIES, DON'T LISTEN TO THAT, APPLESCRIPT IS GOOD FOR MANY
THINGS, AND GREAT AT APPLICATION SCRIPTING.
Like what?
I agree that AppleScript is great for application scripting, but
Python, Ruby and ObjC are also damn good these days and Perl, while
not great, isn't awful either. The only area where AppleScript
remains superior is OSA attachability support, though even there the
gap is slowly closing.
On the other hand, for GUI application development, Studio is merely
passable - adequate for more basic applications but quickly runs out
of steam for more complex tasks, and hardly user-friendly towards non-
programmers. FaceSpan is better if you're willing to pay for the
privilege; OTOH, unless you really need AppleScript's application
scripting abilities you might as well go for Revolution or REALbasic
which have better general capabilities.
Beyond that, text processing: yuk. XML processing: meh if you're
counting System Events; and compared to other platforms, yuk.
Precision math: yuk. Graphics and 3D: yuk. Audio: yuk. Any other sort
of heavy-duty data crunching: yuk. Connectivity: Apple events or yuk.
Performance-sensitive tasks: yuk. Extensibility and customisation:
yuk. Scalability: yuk. Portability: yuk. Library support: yuk.
Debugging: yuk, unless you buy Script Debugger. Profiling: yuk.
Learning how to program: yuk. I could go on, but it'd probably be
quicker if you just listed the non-application scripting-related
tasks at which you think AppleScript doesn't suck and I can shoot
them down as needed.
In short, for any given task, unless there's an application you can
script to perform that task for you, you will be dealing with so much
yuk unless you're willing to consider other options in addition to,
or instead of, AppleScript. While there are some third-party language
extensions that go some way to ameliorating a few of AS's
deficiencies (e.g. TextCommands, Satimage's osaxen), AppleScript's
lack of native extension support requires them to operate at arm's
length, meaning they can only do so much.
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