[Petal] Interoperability
Jim Fulton
jim@zope.com
Sat, 27 Jul 2002 13:58:52 -0400
Jean-Michel Hiver wrote:
...
> I took a lot of good ideas from TAL, but then on top of that I added a
> lot of other ideas and changed a couple of things... At the moment, this
> is more or less in beta stage (the module is still pretty young, but it
> will be usable very soon now).
>
> Nonetheless if I can do something to increase Petal interoperability
> without sacrificing features, I'll do it.
Great!
> Feel free to take a look at
> the Petal documentation
>
> http://search.cpan.org/search?mode=module&query=Petal
>
> Maybe you ought to take a look at the documentation, see what are the
> similarities (lots) and differences (again, lots :-)) between the two
> systems, and from there I'll happily welcome any suggestion that would
> increase interoperability / usefullness of the package.
OK, Thanks. I've taken a look. I want, first, to understand the
new features. These seem to be:
- alternative syntax ($-interpolation, and processing directives).
- ... help me out here. :)
Could you list any additional features, as opposed to simple differences?
What motivates the alternative syntaxes. The $-interpolation would
show up in mock-ups, which would seem to be a bad thing. Are you sure
that processing directives will be properly maintainied. Do the alternate
syntaxes offer anything over the standard TAL syntax?
Why use "petal:" rather that "tal:"? That difference seems gratuitous.
Of course, when working with XML, I *asume* one could provide a namespace
declaration and use "tal:", right?
It appears that you have invented your own expression syntax.
I don't think that "my_array.12" is perl syntax, is it? Why not use
"my_array/12" as in ZPT? It appears to me that your dot and ZPT's
slash have the same meaning.
We try *very* hard to keep Python expressions out of our templates.
This is based on our experience with our older templating language,
DTML, that became a scripting language through lack of discipline.
We are very wary of making this mistake again and I encourage
you to be wary too. We do occasionally need simple Python expressions,
like "len(results) > 20" in conditional statements. It would be nice if
we (together) could come up with a simple expression syntax that was
not Python and that could handle cases like this.
Your modifiers are mostly very similar to TALES expression types.
Is there any reason we couldn't make them more similar so that
we could have the same spelling, at least when the meaning is the
same?
> However I don't think I'll ever limit the development of Petal to
> strictly the TAL spec. I mean, I like to be able to write:
>
> $encode_html:object.title -OR-
> <?petal:var name=":encode_html object.title"?> -OR-
> <span petal:replace=":encode_html object.title">Dummy title</span>
>
> Perl madmen worship the TIMTOWDI you know :-)
That is a bit of a culture clash. ;)
It would be helpful if there was at least one way to do it
with Petal that was highly compatible with ZPT.
Jim
--
Jim Fulton mailto:jim@zope.com Python Powered!
CTO (888) 344-4332 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org