Re: Record/List Coercion
Re: Record/List Coercion
- Subject: Re: Record/List Coercion
- From: "Mark J. Reed" <email@hidden>
- Date: Wed, 30 Apr 2008 08:42:11 -0400
Partly... I suppose it's as much a cultural "what you're used to"
thing as anything, but consider how code reuse works in Perl.
...Pause for retching... Done? Good.
Now say I'm writing a Perl script to solve some problem, and having
ordered hashes would simplify things considerably. I type:
$ sudo cpan OrderedHash
And type in my password. When cpan finishes running, I have the ability to put
use OrderedHash;
At the top of my Perl script and thereby import that functionality. I
don't have to know where OrderedHash.pm lives on disk. Maybe it's not
even a .pm, but a compiled extension written in C, like an osax -
except instead of magically appearing in my namespace whether I need
it or not, it's still only loaded on request, and the code that uses
it doesn't change if I take a Perl implementation and redo it in C for
performance reasons.
If I try to run the script on a system that doesn't have OrderedHash
installed, I get a message that says "OrderedHash isn't installed." Or
words to that effect. Which makes it easy to rectify the situation.
For Python, replace cpan with easy_install. For Ruby, use gem. PHP?
Pear. Applescript?
Even manually, how do I do that sort of thing? Where on disk can I
put a script so that my other AppleScripts can load it without having
the location hard-coded and without bundling them together?
The other languuage implementations above not only have standard
libraries, but also allow the user to supplement the library with
nonstandard locations. By setting the environment variables PERLLIB,
PYTHONPATH, RUBYLIB, I can say "hey, look over here for modules, too".
Which means that even on a multiuser system where I don't have root
(such things do still exist. ;)) I can install extra modules as
needed.
In AS, there's hardly any code reuse. Sure, there are popular osaxen,
but osaxen aren't written in AS. It takes a different set of skills to
make an osax. So aside from copying and pasting, stuff gets written
over and over again.
On 4/30/08, Shane Stanley <email@hidden> wrote:
> On 30/4/08 9:13 PM, "Mark J. Reed" <email@hidden> wrote:
>
> > For my money, in fact, the biggest missing feature in AppleScript is
> > not associative arrays, but an easier way to use external libraries.
> > "load script" would be sufficient if it had some sort of search path
> > behind it.
>
> Does not "path to resource" at least partly fit that bill?
>
> --
> Shane Stanley <email@hidden>
>
>
> _______________________________________________
> 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
>
--
Sent from Gmail for mobile | mobile.google.com
Mark J. Reed <email@hidden>
_______________________________________________
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