Re: Informal poll
Re: Informal poll
- Subject: Re: Informal poll
- From: Nigel Garvey <email@hidden>
- Date: Thu, 19 Jun 2014 17:36:10 +0100
Shane Stanley wrote on Wed, 18 Jun 2014 10:28:21 +1000:
>On 17 Jun 2014, at 8:22 pm, Nigel Garvey
><email@hidden> wrote:
>
>> The new system, despite the hype in the videos to which James linked,
only
>> adds [...] and the ability to use non-vanilla terminology out of
>> context in scripts, if you think that's a clever idea.
>
>I think your last point relates to the use command,
Yes indeed.
>but that really has
>nothing to do with libraries; you can address libraries with or without
it,
>just as you can write any script with or without it. The command is
>*required* only within a library script itself, and then only for
loading
>frameworks if it's ASObjC-based.
>
>There's a fair bit of confusion on this point, partly because the two
>features were introduced at the same time,
The 'use' command was introduced in the _context_ of Libraries in the
WWDC videos.
But I didn't mean to imply that the new Libraries system is itself a bad
idea or that it _forces_ one to write bad code — only that it's not as
dramatically exciting a development as the video'd presentations try to
make it appear.
Script libraries were already possible using the 'load script' command
and, contrary to the implications in the videos, it wasn't necessary for
them to be scattered all over your system so that you didn't know where
they were and it wasn't necessary to nest 'tell' statements two or three
deep when writing for more than one application. The demos showing the
new system removing these problems aren't worth the applause.
The new 'script' reference _is_ slightly less bother than specifying a
file, but currently only works if the library's at the _root level_ of
one of the "Script Libraries" folders.
Being able to invent your own command terminology is sexy, but the
suggestion in the videos that command names are easier to remember than
handler names is somewhat assuming. It depends entirely on your own
mental wiring and the names you've chosen. What applies to you may not
apply to others trying to debug your scripts or use your libraries. The
ability to include dictionaries of your own commands would be more
impressive if AppleScript Editor actually offered a field template for
creating them and saved the results, appropriately XML-formatted,
directly to or with the library bundles instead of it being necessary to
write the XML yourself in a text editor, save it, and drag the resulting
files into place.
The WWDC videos actively encourage the use of 'use' to eliminate 'tell'
statements. In my view, this only superficially prettifies code. It
doesn't make it any clearer and actually places a burden on people
trying to debug or modify it, since they constantly have to double-check
the provenance of terms they encounter instead of having it presented on
the screen as the relevant 'tell' statements. In the Contacts/Mail 'use'
demo in one of the videos, the before and after scripts are really just
bad in different ways. One switches around between the two applications
using 'tells' nested three deep; the other does the same using no
'tells' at all. (For the task involved, of course, the nesting can
easily be avoided — and the script made more efficient and readable — by
having one line at the top which dumps the relevant names and e-mail
addresses from Contacts to two parallel lists, and cycling through these
lists instead of through Contacts elements while dealing with Mail.)
With regard to ASObjC, while it's a pity it can only be used in
Libraries libraries (and the clunky
save-as-bundle/open-drawer/click-checkbox/save-again process for saving
such libraries is a definite minus), one side-effect of what integration
there is with vanilla is there's now yet another handler definition
syntax which works in vanilla and which I've seen used a couple of times
in vanilla scripts. I haven't yet decided whether I think this is a
useful thing or a potential cause of confusion.
NG
_______________________________________________
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