[ZPT] TALES: Path expressions?

Joel Burton joel@joelburton.com
Wed, 6 Mar 2002 09:44:58 -0500 (EST)


On Wed, 6 Mar 2002, Alan Kennedy wrote:

> 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.

Possibly. But Python expressions lead to some ugliness, such as when
dealing with objects with a . in their name, and having to know whether
something is callable () or not.

  here/foo/submit.html

is easier and nicer than

  here.foo['submit.html']()

plus I think independence from Python was one of design intentions of the
ZPT package.

-- 

Joel BURTON  |  joel@joelburton.com  |  joelburton.com  |  aim: wjoelburton
Independent Knowledge Management Consultant