[Zope] The new DTML syntax

Alexander Staubo alex@mop.no
Thu, 5 Aug 1999 18:09:48 +0200


Am I the only one who does not take particularly kindly to the new DTML
syntax? Well, I guess I might be. :)  Before you bring forth the
lynching implements, though, hear me out.

In my opinion the number one problem is that the word "dtml" detracts
from readability (as does the fact that the new syntax is visually less
distinguishable from HTML or XML, but I guess that as we're dealing with
SGML-like markup languages we can't really avoid that).

When I think "if", I want to type "if", not "dtml-if", and consequently
I typically end up writing "if", backtracking a bit, typing "dtml-" and
then going on from there. That's just me, I guess. But the point is, the
inclusion of "dtml-" spins my mind through too many connotations. If I
had to type "html-" before every HTML tag, the same thing would happen.
It would be a pain. Since control characters (<, >, :, # and so forth)
do not carry the baggage of mental associations, they are more
efficient, and that's why the old "<!--#" sequence still comes easier to
my mind than the new syntax.

Another, possibly more powerful argument is that the new syntax is
essentially backwards: The actually "command" or "directive" doesn't
start until 7 characters into the tag ("<dtml-"). To match one dtml-if
against its closing tag, the mind must visually match a whole 7
characters ("dtml-if"), which is awkward. More than that,
psychologically a sequence of characters such as "dtml-if" is much less
efficient for pattern matching than just the sequence "if", especially
if we consider the multitude of DTML keywords: They all share the common
prefix "dtml-", making them variations of a spelling rather than
separate, mind-sortable entities. The fact that the closing tag slash --
as in "</dtml-if>" precedes the "dtml" part actually _forces_ your brain
to process the whole string, as opposed to just honing in on the "if"
part.

I don't know about you, but my mind sifts through a list such as

	if
	in
	var
	else
	unless
	sqltest
	call

must faster than

	dtml-if
	dtml-in
	dtml-var
	dtml-else
	dtml-unless
	dtml-sqltest
	dtml-call

Imho, Cold Fusion's CFML syntax does one notch better than DTML because
it only devotes two characters ("CF") to distinguishing Cold Fusion tags
from other markup, so you have keywords such as "cfquery", "cfoutput",
and so on. Easily recognizable, short, sweet, easy to type. On the other
hand, it uses a proprietary syntax for in-place variable insertion (eg.,
"#Name#" inserts the variable Name), so it's not all bliss.

While I realize this stuff is somewhat subjective, from a technical
viewpoint my opinion is that we're not there quite yet.

Bring on the pitchforks and torches. :)

-- 
Alexander Staubo             http://www.mop.no/~alex/
"It has taken the planet Earth 4.5 billion years to discover it is
4.5 billion years old." --George Wald