Re: the Holy Grail of AppleScript lists
Re: the Holy Grail of AppleScript lists
- Subject: Re: the Holy Grail of AppleScript lists
- From: has <email@hidden>
- Date: Thu, 20 Mar 2003 21:45:41 +0000
Paul Skinner wrote:
> -->list of 8291 items.
>
Nothing very remarkable in this. Despite what the Standard Additions
dictionary might claim, the 'do shell script' command returns Unicode
text, not a string. The ~4000-item stack overflow problem only affects
the latter type.
>
You say that as if it's common knowledge. Did I miss the memo?
I don't believe it was ever broken, and can't recall anyone ever saying it was.
Maybe some folk were thinking that because the string type was buggy
the Unicode type would have the same bug too? If so, that's a bad
assumption - like thinking that because Firestone tyres blow up,
tyres from every other manufacturer will explode as well. Case in
point: the Unicode text type [IIRC] for a while had TID-related bugs
which the string type didn't, and nobody thought the string type was
broken because of it.
[shell script sort limitations]
Perl is the way I plan to go for a full featured sort handler.
However, the shell sort is very useful. Very frequently I sort a short
list of text or numbers. sort has less overhead than perl and handles
simple sorts fast and easily.
If you manage to come up with a general-purpose sort, I'd be
interested to see it. Re. what you've currently got: it'd be a good
idea to document its limitations (e.g. "this works for strings
containing ASCII 0-9 & 11-127 characters only, and will return a bad
result for anything else; result will be a list of Unicode text
values, regardless of source data's type(s)"), especially if you
publish it for other folks to use. (BTW, if you want a sort routine
that can do sorting on multiple fields, reverse ordering, and
sub-grouping of results, drop a note and I'll send you one off-list.
Fast enough for most tasks, and good for stuff like sorting birthday
dates, records, Finder file objects by name/date/size/etc, as well as
simple lists.)
> - I fail to see your problem with using Serge's quicksort library [...]
has, I assure you that I have no such hangups.
Your "Oh My God" comment the other day seemed to suggest you had a
problem with it. <shrug> (Any other hangups, I probably don't want to
know about.;)
Applescript is not the most powerful text processing language;
Too true. I'm wondering though if it'd make more sense to work the
other way around when writing scripts that do the majority of work
themselves, rather than jumping back and forth all over the place.
AS's only real advantage over Python, say, is its superior OSA
support. (AS syntax's easy readability is kinda negated by its
not-so-easy writability; Python syntax isn't quite as pretty but it's
clean and predictable.) So if you're not using that much application
stuff then it might be better to develop in Perl or Python, and only
fall back on AS when you need to. Plus, it might be a good
opportunity to go agitate in those camps a bit. I bet if there was
more pressure for better OSA support in Perl and Python, they'd soon
enough improve to the point where folk who've outgrown AS could
smoothly transition to one of those languages without having to jump
through hoops to do their usual application control stuff.
Cheers,
has
--
http://www.barple.pwp.blueyonder.co.uk -- The Little Page of AppleScripts
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.