[Pythonmac-SIG] appscript terminology caching

Jack Jansen Jack.Jansen at cwi.nl
Sat Oct 16 23:30:17 CEST 2004


On 16 Oct 2004, at 17:06, has wrote:
>  I see all this as an opportunity though: for MacPython to come up 
> with the best damn scripting support of _any_ language, and become 
> _the_ role model for others to follow. Hence this discussion, to shake 
> out the good ideas from bad and see if anything's left standing by the 
> end of it. <g>

Yeah! Towards World Domination!

I've been giving the whole subject (caching, precompiling, etc) a 
little more thought (over the last cigarette:-), and I think there are 
really two types of users. Or, actually, two types of use cases, 
probably with most users going from one to the other.

The first use case is throwaway scripts, or the development stage of a 
longer lived script. At this stage ease of use is the most important 
feature. This seems to point towards dynamic compilation of 
terminology.

The second use case is anything from a production script to a 
distributable binary application. Now you are much more interested in 
stability and efficiency. This points towards static precompilation of 
terminology.

Notice that the wrong type of compilation is actually detrimental to 
the use cases:
- if you have precompiled terminology while developing a script and 
that terminology is outdated the user will be wondering why s/he cannot 
access the same features of yesterday's release of SampleApplication.
- if we compile terminology on the fly Python scripts will not only be 
less efficient than AppleScripts, but they'll also be prone to more 
incompatibilities. AppleScripts continue running as long as the 
underlying codes remain valid, and if that isn't true then it's the 
vendor of SampleApplication who's gonna get the blame.

Assuming we agree on the previous bits there's one difficult question 
remaining: when and how do you switch from dynamic to static 
compilation? My feeling is that the user (the script developer) should 
somehow do this explicitly, as the user is the only person who knows 
when the script goes from development stage to production stage. I 
think it's clear that py2app should precompile terminology. The same is 
probably true when you save your script as an applet. At the other end 
of the spectrum there's running your script in the IDE, an which case 
you definitely don't want it. But in-between (double-clickable or 
commandline script) things are a bit less clear, because we don't 
really know what stage the user is in. Maybe we should use the MacOS9 
Script Editor distinction (Script, Runnable Script, Applet) with the 
latter two using precompiled terminology?

Note that there's one thing here that I haven't said explicitly yet, 
but that I think is important: the distinction between development and 
production is per-script, not per-user or systemwide or whatever. And a 
module counts as a script too. And I have no clear idea yet how to 
implement this (aside from yesterday's half-baked idea of storing the 
terminology somewhere alongside the .pyc file for the module/script 
using the terminology, but that's only half-baked because it ignores 
reuse).
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma 
Goldman



More information about the Pythonmac-SIG mailing list