Script Library caching
Script Library caching
- Subject: Script Library caching
- From: Chris Page <email@hidden>
- Date: Thu, 07 Jan 2016 06:40:35 -0800
> On Jan 5, 2016, at 5:31 PM, has <email@hidden> wrote:
>
> Furthermore, there seems to be some degree of caching going on, possibly in AS, possibly in SE, possibly in something else, because sometimes when I move my dummy script in or out of the 'Script Libraries' folder the test script still manifests the previous behavior the next time I run it. Recompiling seems to make it catch up to the change, but that itself is hardly a reassurance.
AppleScript caches the locations of libraries so it doesn't have to search files every time a library is referenced. Once a library is loaded, the cache allows it to locate the one in memory without I/O. Script Editor creates a new instance of AppleScript each time you compile a script document, thereby resetting the cache (and causing it to load the latest library from disk the next time it is referenced). You should find that compiling (at least with Script Editor and osacompile) will always find libraries as they are currently on disk. If it doesn't, please file a bug report: https://developer.apple.com/bug-reporting/
This is one reason why it is preferable for each component instance to be able to have different library versions loaded. If an instance loads a library, the library should be the same library as long as it is still referenced, but OSA clients have the flexibility of creating a new instance to pick up a different version, even while still executing scripts in another instance that are still using one that was loaded earlier. Script Editor gives each open document its own AppleScript instance, and creates a new instance with each compile, so each script's “universe” is up to date, without interfering with other open documents, which may be executing at the time.
--
Chris Page
The other, other AppleScript Chris
_______________________________________________
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