Re: Libraries and effiency
Re: Libraries and effiency
- Subject: Re: Libraries and effiency
- From: Tommy Bollman <email@hidden>
- Date: Fri, 6 Aug 2010 13:05:37 +0200
Hello.
Last night I looked at Tetsuros code, and his way of make this mechanism work, taking for granted that the code does what it is supposed to do. It is all very clever, but IMHO, this approach is dangerous.
The things I find dangerous is that you can't hardcode paths to libraries, and that the module loader will search several libraries and use the script library found in the latest path. It is stuff like this that creates situations where it is very hard to detect what is really going on when something is at err.
The problem he tries to solve with this, is of course the hardcoding of the paths for one, and the dependency checks for the other, and autoloading of dependencies. -As do AppleMods, but AppleMods relies on hard coded paths, which is better from my perspective as hard coded paths doesn't lead to any ambiguities as to which library is loaded.
Predefined paths and all that, is really modern,, and gives AppleScript a load mechanism like all other languages. But the names of the libraries loaded should always be unique if they are to be loaded by such an implicit method. It should as a matter of fact be disallowed to use the same name for a library residing in two different directories.
I have a very different approach, and a different idea. I also use predefined paths in the Library Loader to pick the library you want to create a load statement for. -The Library Loader then creates a hardcoded statement for you. And you don't have to load the library from any of the predefined paths, you can pretty much pick it from wherever you like, if you are testing something.
The library loader really doesn't care what is within what you load, wether it is an AppleMods system or from a module loader system.. I will however implement the load mechanisms for both of those systems.
Script Library Server, which will be finished and uploaded to day, (a Script Library Server that unloads modules when they haven't been used for a specified amount of time.) would really leverage on both of these mechanisms, if it comes to that of dependencies, and it does!
Because the server it self doesn't keep track of dependencies among modules/units.
The LibraryLister, which will be updated in the near future, will need Tetsuros permission to render his code at MacScripter.net, If I am to support the dependencies, This goes for AppleMods as well. Here dropping the needs for tracking dependencies and from which path the library script is taken from is obvious. As the hardcoding of paths saves a fair amount of processing time and disk IO. The idea here is to list everything in a script which contains something, except for script objects which only contain properties, and the ability to automatically open that file for inspection.
I have tried to sum up how your choices of loader mechanism will inflict upon tomorrows software that will ease your scripting.
You should really use one of the two.
On 31 Jul 2010, at 04:52, Philip Aker wrote:
> On 2010-07-30, at 18:13:11, Tetsuro KURITA wrote:
>
>> "ModuleLoader" can automatically load libraries which loaded libraries require.
>
> Smart thinking Tetsuro.
>
>
> Philip Aker
> echo email@hidden@nl | tr a-z@. p-za-o.@
>
> Democracy: Two wolves and a sheep voting on lunch.
>
> _______________________________________________
> 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
>
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