[
Lists Home |
Date Index |
Thread Index
]
Dave,
On Wed, 21 Apr 2004, Dave Pawson wrote:
> >We don't need to go back to the language-and-thought thread of a few
> >months ago, in order to agree that how programming languages look is
> >important. A language that is hard to read is hard to write, and that's
> >as true of XSLT-in-XML as it is of anything else.
> >
> >Thus this discussion isn't about _compact_ syntax, but (human) _readable_
> >syntax.
>
> Isn't that what computers are good at? or supposed to be.
> Take 'regular' stuff (from this damned wire again I suppose)
> and make it pretty for the end user, reader, machine.
I'm not sure if we're disagreeing here. For the purposes of this
discussion, I'm not interested in what's on the wire, and agree that
computers are entirely suitable for doing the transformation between
the wire and the screen, and indeed that we could be doing more of it.
The question is what should it be on the screen; and the answer depends
on the context (as your message goes on to suggest).
> How languages look hides too many sins Norman.
> Is it lazyness?
> I can't be bothered to write all those pointy brackets so
> use a compact form.
Well, unless you're determinedly primitivist (I'm thinking of vi, here),
then your editor can put in the (correct) end-tag for you, so the
question of compact syntaxes is _not_ a matter of saving typing. That's
a red herring.
Instead, there's a practical matter of, say, how many XSL templates you
can see on your screen at once; and with a verbose syntax like instance
syntax, the answer is `not many'.
Also there's the more theoretical point of `7 plus or minus 2' -- the
famous psychological claim that we can only hold seven-ish things in
mind at once. As we get more experienced with a tool or a language, we
chunk it in more sophisticated ways, but this is where readable syntaxes
can help.
I'm sure that if you spend a huge amount of time with XSLT, then your
brain simply stops seeing the end-tags. If I look at the following,
for example:
<xsl:template match='@* | node()'>
<xsl:copy>
<xsl:apply-templates select='@* | node()'/>
</xsl:copy>
</xsl:template>
the last two lines are just noise. You spend more time with this, and
I'm sure _you_ see only three things; possibly only one. I'm seeing
five things where I should be seeing three. If I haven't been using
XSLT for a little while, I see seven things, counting the attributes,
and my poor brain fuses.
This is why, in suitable contexts, compact=readable.
This is why RNC compact syntax is more readable -- you're not squinting
to extract the meaning from amidst all the visual noise. And I at least
find something like
(template "@* | node()"
(copy
(apply-templates "@* | node()")))
has more chunkable structure, and is simply easier to read (and I'm not
an old-timer lisp maniac).
> Is it interpretation for the reader?
> I (or someone) has written valid XML and I just want to 'read' it,
> in some way that I prefer (styling).
> Is it inspection?
> The big fat inspector wants to know if X has tagged up the
> document in the right way? (Call it QA).
I'm not talking about styling, in the sense of formatting/colouring
parts of a document for easy reading. And I'm not talking about tagging
documents -- where there's more content than markup, compact markup
would potentially _decrease_ readability (OMITTAG was cute, but we can
live without it).
All the best,
Norman
--
---------------------------------------------------------------------------
Norman Gray http://www.astro.gla.ac.uk/users/norman/
Physics and Astronomy, University of Glasgow, UK norman@astro.gla.ac.uk
|