[ZPT] TALES: Path expressions?
Alan Kennedy
zpt@xhaus.com
Wed, 6 Mar 2002 05:40:36 EST5EDT
Greetings,
I am looking closely at TALES, and wondering why it
contains path expressions?
It seems to me that having an Expression Syntax that did
not contain path expressions would be much simpler to
implement. The grammar would be much simpler and quicker to
compile and interpret, for one thing.
Take for example, the expression inside a tal:repeat
statement, which has two parts: the former part is a loop
variable name and the latter part is an expression which
results in a sequence when evaluated.
It seems to me that the latter part could simply be a
python expression, which could simply be passed to the
python 'eval()' function.
So dealing with a tal:repeat expression would simply
involve splitting it in two, using whitespace as a
delimiter, giving a name and a python expression.
This would eliminate the need for parsing the TALES
expression using regular expressions.
The python expression would then be passed to the "eval()"
function, and evaluated inside a suitable python namespace.
I think (I'm not yet certain :-) the same holds true for
the expressions used in all TAL commands.
tal:condition - Either true or false python expression
tal:replace - Python string expression
tal:content - Python string expression
tal:attributes - See below
tal:omit-tag - Either true or false python expression
a tal:attributes expression could be split into a series of
name/expression pairs separated by ';' (';;' excepted of
course).
I'm not trying to get TALES changed here. I'm just
investigating doing my own TAL/TALES/METAL implementation
suitable for use in Java/Jython servlets.
Why? Because ZPT is way cool, that's why!
Grateful to receive any pointers or opinions.
Cheers,
Alan.
---------------------------------------------
This message was sent using WebMail by CyberGate.
http://www.gate.net/webmail