[ZPT] CVS: Packages/TAL - README.txt:1.14

Guido van Rossum guido@digicool.com
Mon, 09 Apr 2001 19:04:21 -0500


> From: "Guido van Rossum" <guido@digicool.com>
> > Do you want me to provide a function that checks whether a program is
> > still valid?  I propose the following API:
> >
> >     import TALDefs
> >
> >     TALDefs.isValidProgram((program, macros)) -> Boolean
> >
> > Note that isValidProgram() takes a single argument that's a tuple of
> > (program, macros) -- that way you can pass it the cached output from a
> > previous compilation without having to know its structure.

[Evan]
> Hmm.  I already pay close attention to its structure, since I expose the
> macros separately.  Hey, I just noticed; TALInterpreter doesn't do anything
> with the macros argument except hold onto it, right?  Also, a macro is a
> valid program in its own right.  So really, this should just accept a single
> program.  The macro program will get tested for validity when a use-macro
> tries to retreive it.

Hm, but macros don't have a version number of their own.  Should they?

> > This wouldn't be a surefire test, e.g. if you gave it a
> > hand-constructed tuple you might have something that passed the test
> 
> In that case, the name seems to promise too much.  How about
> TALDefs.isCurrentVersion(program)?

OK.

I just realized: there's an issue with mixing XML macros and HTML code
or vice versa: the macros are optimized/precompiled for the mode used
to compile them.  To fix this I would probably need another inquiry
function that returns the mode ("xml" or "html") from a program, *and*
add version *and* mode instructions to all macros.

--Guido van Rossum (home page: http://www.python.org/~guido/)