clarification re. test references (Re: [Pythonmac-SIG] [ann] appscript 0.4.0 released)

has hengist.podd at virgin.net
Fri Feb 13 14:53:39 EST 2004


Hi all,

Just to clarify how appscript's 'test expressions' work, since I 
haven't gone into it yet:

- Comparison tests (e.g. its.size > 1024) have the form:

    <test-reference> <operator> <value>

- Logical tests would ideally have the form:

    <ComparisonTest-or-LogicalTest> <operator> <ComparisonTest-or-LogicalTest>

Comparison expressions evaluate to a ComparisonTest instance, while 
logical expressions evaluate to a LogicalTest instance. It's a basic 
capture mechanism: these objects 'record' a test expression's 
structure, allowing it to be reconstructed as AEDescs. Actually 
evaluating the expression as an expression is left to the scriptable 
app; appscript doesn't do this itself.

Pretty straightforward once you wrap your head around it. (Would be 
simpler though if you could use Lisp-style macros to buzz through the 
AST instead. Ah well.)

(BTW, next job's to work on the documentation, particularly the 
implementation stuff. This'll make things much clearer.)

HTH

has
-- 
http://freespace.virgin.net/hamish.sanderson/



More information about the Pythonmac-SIG mailing list