-----Original Message----- From: Martijn Pieters [mailto:mj@antraciet.nl] Sent: Thursday, October 07, 1999 18:30 To: Jay, Dylan; 'zope@zope.org' Cc: 'zope-dev@zope.org' Subject: Re: [Zope-dev] inconsistency in tag argument syntax
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.
First let me clarify. By incosistent I meant from a user perspective. To have one named argument be treated completely differently from another depending on context is very confusing for the user. I think that logical consistancy and readability of a language are very important. It seems these were very important in the design of python however I don't think those principles have translated as nicely to DTML. DTML's goal should be to easy for everyone. Basically syntax "exceptions" are not a way to make an easy to use language. Anyone who has learnt english as a second language will tell you how hard it is because english has so many "exceptions". As for speed, this is irrelevent. A static value can be recorded as such regardless if a variable can be used instead. A simple check to determine if it is static or not is not a big performance hit.
participants (1)
-
Jay, Dylan