Re: AS Library Question
Re: AS Library Question
- Subject: Re: AS Library Question
- From: Shane Stanley <email@hidden>
- Date: Tue, 22 Dec 2015 10:33:09 +1100
On 22 Dec 2015, at 5:45 AM, Stockly, Ed <email@hidden> wrote:
>
> I would love to see this put together as an AppleScript library.
You can use it as it is:
use ss : script "SmartString"
tell ss's SmartString
newString("Cat and cat")
-- do stuff
considering case
replaceString("cat", "dog")
end considering
end tell
I'd be inclined to modify it slightly to put the script object within newString(), for the reason in parens below.
> There's enough in this to make it valuable to almost anyone working with
> lots of strings and file paths, and enough variety to provide good
> examples of how to build and use libraries.
It's a good example of how to build an object-oriented library (although the copy thing falls down if you add any ASObjC, and I think you'd do that at least to replace the case-conversion stuff), and that's a good thing. But it's also a more complicated thing than building a library with a bunch of standalone handlers, which I'd suggest is a perhaps a better place to start. I mean, as a learning tool you're telling users to dive in at the deep end.
>
> It's easy enough to package with a script nowadays, so no requirement it
> be included in the standard install (although that would be nice.)
There are a couple of reasons I'm nervous about all the talk of a StandardLib. One is that I fear pleasing everyone would result in KitchenSinkLib, and it would be overwhelming to use. And a related issue is that, as users of very large scripts know, AppleScript has its size limits. Loading huge amounts of stuff before you get to your own code would, I suspect, significantly lower the barrier those dreaded table-overflow errors. So I think users curating their own libs beyond the basics has a lot of merit.
>
> With the AppleScript Libraries we can include an SDF and appleScript
> terminology, and I think that would be cool, but I'm worried about adding
> possible terminology conflicts.
Verbosity is your friend. The real problem is with scripting additions' terms. If you can be bothered passing on the "use scripting additions" line (assuming you load the library with a "use" statement), wrapping any addition calls with "using terms from scripting additions" solves that problem, too.
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>
_______________________________________________
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