Re: What makes AppleScript difficult
Re: What makes AppleScript difficult
- Subject: Re: What makes AppleScript difficult
- From: Brennan <email@hidden>
- Date: Mon, 10 Dec 2007 12:46:24 +0100
Here are a few features of the AppleScript core language which could
significantly improve our experience and make it less 'difficult'.
I hope I don't need to point out that we've been waiting (and asking) for
many of these features for years:
1) The 'filter reference form' (where it... clauses or whose... clauses)
should also be supported by the list and record datatype, not just
application objects.
2) Text item delimiters is a list, but is always treated as a single item.
The fact that it's a list implies that Apple always intended there to be
multiple text item delimiters, and in fact I think I recall one of the
Chris's saying so.
It would be *very* useful to have multiple delimiters - especially if they
could be scoped somehow.
i.e. if a script object could set 'my text item delimiters' and not
pollute 'applescript's text item delimiters'.
3) We have 'exit repeat', I'd like to see 'next repeat'. i.e. a control
statement which aborts the current iteration and proceeds to the next one
without leaving the loop. Not sure if this was in hypertalk, but I saw it
in Lingo, which was very close to hypertalk in the old days.
4) Should be able to get the position (index) of a known item in a list.
e.g. index of 99 in {1,99,256} --> should return 2
5) Built in features for changing base of numbers
6) Built in features for changing case of strings
7) Operator or function for testing the case of a single character.
***
Now for some dreamy wishes for the core language:
AppleScript is clearly inspired by LISP, somewhere along the line.
I'd love to see some kind of 'mapchar' functionality, such as the ability
to add an integer to (or concatenate a string with) every item in a list
without making a loop. Bytecode loops are slow. This could be done at
'native' speed.
Syntactical sugar, yes, but we're talking scripting here, which is all
about getting things done fast, in a way that non-programmers can
understand.
Similarly, it ought to be possible to (for example) add two lists of
integers in such a way that item 1 of list A is added to item 1 of list B,
item 2 of list A is added to item 2 of list B, and so on, and resulting in
a single list containing the result of each mapped addition.
This kind of thing could be very useful for adding prefixes to filenames,
for example.
Also stuff like
((characters {1,5,7,3,-10} of myString) as string)
and
(occurences of 9 in {9,2,5,9}) --> {1,4}
Why not? A guy can dream. LISP is full of this kind of stuff.
Am I spoiled? Come on!
***
Finally, not the core language, but some things which would make
AppleScript less difficult, more appealing and more useable:
1) Apple should provide idiot-proof examples for working with the many and
various ways of referring to files. There is far too much confusion about
this. Perhaps with some kind of table describing what you can and can't do
with each kind, examples of coercions between them and so on.
2) XML support should be standard without occult plist hacks or third
party extensions. (Apple should have no qualms about cannibalising its
third party developers in this case, because the two third party XML
extensions are freeware anyway. Apple should license both, and merge them
into a single default-install scripting addition.)
3) There should be some easy way of making dictionaries for our own
AppleScript apps. (Or at least AppleScript Studio apps).
4) Last of all, I'd like to echo the calls for Apple to brush up the
scripting interface of its own apps, so that they conform to its own
technotes and recommendations. Eat your own dogfood!
Apple can't do much about screwy scripting implementations from third
parties, but they can certainly do something about their own screwy
scripting implementations.
For example they offer something so idiotic as 'updatePodcast' and
'updateAllPodcasts' in iTunes, instead of offering a podcast class and an
update command. There are various other howlers, but that's under my nose
right now.
_______________________________________________
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