[Zope-dev] Re: TALES idea: tuple unpacking
Shane Hathaway
shane@zope.com
Wed, 23 Jul 2003 20:31:29 -0400
Dieter Maurer wrote:
> Be very reluctant to extend TALES. Do not do it do get just
> syntactic sugar in order to save a few lines of code.
I agree that we should be wary. Adding a feature to make something
simpler simultaneously complicates the whole picture. To offset that
negative, the new feature has to be a lot better than the previous
alternatives. Well, here's a sample of what we'd get with prefixes in
path expressions, all with a very minimal addition to TALES.
"call:" eliminates the need for implicitly calling things. Purely
explicit calling would eliminate a major class of bugs.
"format:" provides access to the same string formatting API that
previously required importing a module. In fact, it seems unlikely
you'll want to import *any* modules in templates anymore.
"zope:" gives you access to a nice Zope-specific API, again without
importing a module.
"dc:" lets you access simple Dublin Core metadata. Perhaps "here/title"
should even be deprecated and replaced with "here/dc:title", since it's
more explicit and more likely to generate the expected result, yet no
more work.
I almost forgot to mention the most compelling reason why we need
prefixes: in Zope 3, we won't be able to fall back on implicit
acquisition anymore, so we need something to replace it. Here's the
(old) proposal that explains it all--
http://dev.zope.org/Zope3/NamespacesInTemplates
You see, prefixes are meant to let you work comfortably in an otherwise
excruciatingly explicit world. :-)
Shane