Re: Libraries and effiency
Re: Libraries and effiency
- Subject: Re: Libraries and effiency
- From: Tommy Bollman <email@hidden>
- Date: Wed, 18 Aug 2010 12:55:41 +0200
Hello Philip.
I wonder why you use XML instead of a property list file structure, with dict and list and all that. I'd really prefer a preferences file. But you might have reasons for using XML, that I'm not aware of.
On 7 Aug 2010, at 10:40, Philip Aker wrote:
On 2010-08-06, at 08:01:29, Philip Aker wrote:
It will be to the benefit of users that each loader implements a few consistent behaviors so they can assess the capabilities of different loaders without having to shuffle their libraries around.
I will post a sketch much later on today and take comments.
Sorry if I missed a cc to any other library loader developers. As a user, what I'd appreciate is that loader developers consider AppleScript's lack of namespaces and devise their own for handler names. For example, instead of 'import' it would be something like: "AM import …", "KT load library …", or "TB set recursive search for library "…" to …".
User Centric Design:
The basic idea is to have a property list which each library loader uses to retrieve the user's preferences for library locations and other details like priority and recursive folder searching.
KISS:
The plist will have a few required keys for which the loader applications may change their values but only by asking the user. Otherwise, the plist is open-ended with an option for additional top-level keys being specified by the loader application's bundle identifier. Typically, if it wishes to extend the plist, the loader app will add a dictionary or array under its bundle id key and specify other key/value pairs according to its needs.
What isn't accounted for so far are Tommy's versioning concerns and (I think) the idea that the the format for libraries be a bundle. Discussion about these items, perceived flaws in the spec, sins of omission, etc. are welcome.
Name:
The name of the plist is "info.libraries.osascript.plist" (i.e. 'defaults <command> info.libraries.osascript […]').
XML Specification:
For easier discussion I'm listing an xml version (easily transformed to plist with xsl).
<info name="info.libraries.osascript" version="0.1">
<array name="DisabledSuffixes">
<string>(Disabled)</string>
</array>
<array name="OtherLibraries">
<string></string>
</array>
<array name="SearchOrder">
<string>UserLibrary</string>
<string>LocalLibrary</string>
<string>NetworkLibrary</string>
</array>
<library name="UserLibrary" reserved="yes">
<property type="uri" name="URI" value="Library/Preferences/Scripts/Modules"/>
<property type="bool" name="SearchRecursively" value="yes"/>
<property type="bool" name="AllowOverrides" value="no"/>
</library>
<library name="LocalLibrary" reserved="yes">
<property type="uri" name="URI" value="/Library/Preferences/Scripts/Modules"/>
<property type="bool" name="SearchRecursively" value="yes"/>
<property type="bool" name="AllowOverrides" value="yes"/>
</library>
<library name="NetworkLibrary" reserved="yes">
<property type="uri" name="URI" value="/Network/Library/Preferences/Scripts/Modules"/>
<property type="bool" name="SearchRecursively" value="yes"/>
<property type="bool" name="AllowOverrides" value="yes"/>
</library>
</info>
Details:
DisabledSuffixes: An array of string. The suffixes of subfolder names in any enabled library path which loaders should not search or load.
OtherLibraries: Array of string of library names. Specifies the names of other "library" elements (in addition to the required 3). The additional locations specified in the named library property will be observed by all library loaders.
SearchOrder: Array of string of library names. This element specifies which libraries the loader should actually use. Effectively, this disables libraries not in this list. In the common case, I believe "NetworkLibrary" will not need be be searched because most users don't have one. This element must have at least one entry.
'library' element: "UserLibrary", "LocalLibrary", and "NetworkLibrary" are required library elements. Otherwise the 'name' attribute must match one of the names specified in "OtherLibraries". The "reserved" attribute is only set on the 3 required libraries. The property values of any library entry may be changed by user choice (i.e. …/Scripts/Modules is only the default).
'property' element 'type' attribute: Used by loaders to determine what kind of value to expect. "uri" specifies the path (POSIX path or URL) of the library. It is up to the library loader to check for transfer protocols, and, in the case of UserLibrary, assume the path is relative to the user's home directory. "bool" = simple boolean value.
'property' element 'name' attribute: Translated to the 'key' element in property lists.
'property' element 'value' attribute: Loaders will use the value as appropriate.
Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@
Democracy: Two wolves and a sheep voting on lunch.
Best regards
Tommy Bollman -------------------------------------------------------------------------------------------------- Mollison's Bureaucracy Hypothesis: If an idea can survive a bureaucratic review and be implemented it wasn't worth doing.
|
_______________________________________________
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