what's in a standard library? [Re: Forward movement vs Tilting at windmills]
what's in a standard library? [Re: Forward movement vs Tilting at windmills]
- Subject: what's in a standard library? [Re: Forward movement vs Tilting at windmills]
- From: has <email@hidden>
- Date: Wed, 23 Nov 2016 19:20:39 +0000
Stockly, Ed wrote:
> I'm wondering if there's any consensus as to what should be included
in a "Standard Library". One thing the AppleScript community lacks is
consensus on nearly everything.
That's why I quietly went ahead and did it. <g> "Executive <cough>
Decision." ;)
...
The libraries I propose (and already provided) are just a heavily
cut-down subset of functionality you already get in other scripting
languages (Python, Ruby, etc), but without all the not-so-useful cruft
and bloat those have accummulated over time, nor any of that arcane
Unix-y weirdness that is irrelevant in AS cos we already have much
better ways of doing a lot of tasks anyways (scriptable apps).
Basically, it breaks to three areas:
* Standard commands generally cover working with built-in data types
(strings, numbers, dates, lists), working with file paths and
reading/writing files. Those were the essential ones.
* Nowadays simple web access is a such a common task (and such a pain to
do with complex does-everything APIs like those in Cocoa) I put that in
too.
* And we all know what a pain it is having lists where you can access
any item by index, but not by a text-based key (aka associated list,
hash, map, dictionary), so I put in a script object for that too (it's
slower than NSDictionary but much more reliable, so it can safely store
complex AS values like application references and records with
keyword-based properties without corrupting them).
Obviously AppleScript does have StandardAdditions, so I didn't overlap
that except where I could add lots more capability for minimal effort
(e.g. being able to round numbers to any number of decimal places).
I deliberately didn't put in any libraries that deal directly with
scriptable apps, cos how long is a piece of string? (A. In application
scripting: light years!) However, if this can kick off interest in
AppleScript libraries at last, that creates all sorts of opportunities
for the AS community to create those more task-specific libraries
themselves. (In which case, I suspect Mark Alldritt might have some
ideas on how to create a community website to host and distribute those.
But let's not run before we're walking.)
...
Okay, I may have added one little indulgence for anyone who regularly
writes '#!/usr/bin/osascript' files for use in Terminal: a small suite
of commands that make it really, really simple to use options (you know,
those `-c`, `-d some-value` things), and to read and write stdin and
stdout while your code is running. I know many of you just use standard
Script Editor applets and `display dialog`, though since we're trying to
get programmers and Terminal users on our side it's a good way to make
it appealing to them too.
--
You can go download them off Mark's repository
<https://github.com/alldritt/applescript-stdlib> (just click the 'Clone
or download' button to get a .zip) if you want to try them out. It can
only help our cause if AppleScripters are already using these libraries
and saying how useful [I hope!] they're finding them!
(Ignore the TestTools and TypeSupport libraries: they just contain
handlers used by other libraries; not intended for users to use themselves.)
...
What's important right now is to persuade Apple to accept and include
what we _already have_ as a "fait accomplis". Once do that, we know
we've got them on our side, and later on we can think what might be
worth adding for 10.14 and beyond.
OTOH, there's no point us debating over changes before we KNOW Apple are
with us, else we're just creating lots of work for ourselves none of
which is going to get used. (Plus we don't want to make it look like we
aren't organized. Think: Bold! Confident! Polished Plan, and Free
Product for Apple!:)
Regards,
has
_______________________________________________
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