[Zope] Syntax: Learning from JSP's problems

Michael Bernstein webmaven@lvcm.com
Thu, 10 Feb 2000 04:05:53 +0000


Jim Fulton wrote:
> 
> Robb Shecter wrote:
> >
> > I think I saw somewhere that a new / alternate syntax for Zope/DHTML
> > is being thought about or worked on.
> 
> I'm not sure what you are refering to.

I think he's referring to the discussion that culminated in replacing
the old <!--#var a--> syntax with the newer <dtml-var a> flavor.

> We've considered for some time
> allowing something like:
> 
>   <dtml-var a/b>
> 
> meaning "insert sub-object b of object a".
> 
> This is a good idea, but we haven't agreed on the semantics
> of the '/'.  Some people assume attribute access. Others expect
> URL traversal, along the lines of what the publisher does.
> Others want URL traversal *and* publisher-style calling.

Hmm. Both useful. Use a different separator for each? you could even
mix-and-match within the same call, I suppose, but it would be a royal
pain to debug...

> <snip>
> For example, the paper
> argues that:
> 
> #foreach $isp in $isps {
>     The next name is $isp.Name <br>
> }
> 
> is more understandable by web-page designers than:
> 
> <foreach item="isp" list="isps">
>    The next name is
>    <jsp:getProperty name="isp"
>     property="name"/> <br>
> </foreach>
> 
> I find this hard to swallow.  Web-page designer's
> tools will certainly have less trouble with the latter
> format than with the former. I certainly prefer:
> 
> <dtml-in isps>
>   The next name is <dtml-var sequence-item><br>
> </dtml-in>
> 
> to either of the above.

I agree. My first foray into web application development used Allaire
Cold Fusion. I chose it because unlike any of the other solutions then
available, it used a tagging syntax. This made it very easy to
transition from HTML design. It also had the advantage of making the
control structures (<CFIF> </CFIF>) completely clear to my eyes that had
already been 'trained' to see logical nesting in tags (your layouts get
really screwed up when you nest tags improperly, or fail to close a
tag).

Zope, when I discovered it, let me leverage my skills in a similar way,
although the unlamented <!--#var a--> syntax made it more dificult than
necessary for a while.

The one thing that DTML lacks is a simpler way of passing parameters to
methods. I would suggest allowing syntax such as <dtml-tag a
name="&value;"> to pass name/value pairs into methods (including python
methods) letting the target methods worry about validating incoming
parameters and default values. this would be much clearer than using the
current REQUEST syntax.

HTH,

Michael Bernstein.