[Zope] Syntax: Learning from JSP's problems
Robb Shecter
shecter@darmstadt.gmd.de
Tue, 08 Feb 2000 16:09:53 +0100
Hi,
Jim Fulton wrote:
> Robb Shecter wrote:
> >
> > Hi,
> >
> > 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 don't either. :) I had seen some metnion of something, somewhere.
> > This article compares JSP to a competing template language that does
> > things (IMO) much better:
> >
> > http://www.servlets.com/soapbox/problems-jsp.html
> >
> > ...For me, the syntax of DHTML is the most difficult aspect of Zope,
> > and is reminiscent of JSP.
>
Let me qualify that: I don't mean to slam on the DHTML syntax. I just
wanted to point out a current discussion going on in the Java world. What
I meant by difficult is: I'm not too adept at DTML yet, and one thing
that throws me is that there are apparently different "levels" of coding;
some statement/commands have their own tags. Some are attributes of a
tag. Some are written inside a string as the value of an attribute. And,
I find the XML tag endings and dtml markers distracting.
>
> That's interesting.
Good.
> From a purely syntactic point of view,
> this paper, favors a perl-style syntax rather than
> an HTML-style syntax and argue that page designers would find
> the perl-style syntax easier to understand. 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.
Hmm - the second one looks like a horror to me. But then, I'm not a web
page designer. Also, Webmacro's syntax was chosen to be deliberately
non-xml-like, so that it *would* work well with html tools. It avoids the
problems of programs choking on, or not displaying unknown tags. The Java
servlet list occasionally has messages like "Looking for JSP-aware
editors"... AFAIK, that isn't a problem with webmacro.
> I certainly prefer:
>
> <dtml-in isps>
> The next name is <dtml-var sequence-item><br>
> </dtml-in>
>
> to either of the above.
>
How about something like:
#in $isps {
The next name is $item <br>
}
Somehow this version is easier on the eyes for me - like I can more easily
pick out the dynamic bits. I guess the real issue is whether xml syntax
is a good thing. I guess there's reasons both for and against it. I do
my scripting by hand, usually, so the extra characters required for
xml-like seeem to get in the way.
> Leaving out syntactical details, I think the paper
> makes some interesting points having to do with the basic
> approach of JSP (and ASP). JSP and ASP are fundamentally,
> though subtley, different from "template languages", like DTML
> and the languages discussed in the paper.
Yes - true. The paper helps categorize things a bit.
- Robb