durusmail: qp: qpy development ideas
qpy development ideas
2007-10-08
2007-10-09
Re: qpy development ideas
2007-10-10
2007-10-10
2007-10-14
2007-10-15
David K. Hess (2 parts)
2007-10-09
2007-10-09
2007-10-10
2007-10-10
2007-10-10
2007-10-10
2007-10-10
qpy development ideas
David Binger
2007-10-08
In .qpy files, the special "template" functions are made
known to the qpy compiler by using "[html]" or "[plain]"
between a function name and the function's parameters.
(This notation was developed before Python's decorator syntax
was decided.)

A pretty simple change to the qpy compiler makes it easy
to support an alternative, decorator-like notation that
looks like this:

@[html]
def f():
     pass

@[str]
def g():
     pass

instead of

def f [html] ():
     pass

def g [plain] ():
     pass

------

The "template decorator", @[html] or @[str] would be required
to appear immediately preceding the "def".

The notation of a template decorator looks like an ordinary
decorator because, like an ordinary decorator, it changes the
meaning of the following function definition.
The difference is that the template decorator's action
happens before the function definition is compiled.

Note that both notations are syntax errors for the ordinary
Python compiler, and this is essential, since it would be
very bad to have templates accidentally compiled with the
wrong compiler.

Your thoughts?




reply