[Zope] Re: [Zope-dev] inconsistency in tag argument syntax

Martijn Pieters mj@antraciet.nl
Thu, 07 Oct 1999 10:29:50 +0200


At 09:32 07/10/99 , Jay, Dylan wrote:
>After playing around with making a tag an inconsistency in the tag syntax
>became apparent to me. Sometimes "asd" is treated as an  expression and
>sometimes as a string. e.g.
><dtml-let blah="aObject.method()"> is an expression however
><dtml-mime name="aObject.method()"> makes the name argument a string with
>'aObject.method()'
>This is confusing and inconsistent. Also treating any argument always as a
>string means that the value of the argument can never be dynamically
>specified i.e. there is no way I could name a mime block dynamically e.g.
>from a form. The same applies for instance to the 'sort' argument in
><dtml-in>. This is very limiting.
>
>The problem is however that I can't see a backwards compatible way of fixing
>this problem. Alternatives are
>a) You could introduce a evaluate expression syntax like there is in sh
>script. i.e. name="`myMethod()`". This however makes things more confusing
>and unreadable.
>b) Another possibility is to make all "non-expression" arguments become
>expression arguments. This would break existing code and mean all string
>constants look like name="'A name'" which is also not intuitive and messy.
>This could be made cleaner by allowing syntax such as name='A name'.
>c) Or ignore the problem.
>
>I prefer option b).
>What do other people think?

Hmm..

This is not as inconsistent and illogical as you think. Your DTML page is 
compiled into a hierarchy of objects, speeding up rendering of the page 
when called. Most attributes are static, which helps. Only those attributes 
that need to be dynamic, are really so, just to help this along. Attributes 
that allow expressions are an exception, not a rule.

--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-7502100 Fax: +31-35-7502111
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------