[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: XML as a transition to s-expr
Dorai Sitaram wrote:
> Scott McKay writes
> >
> > Common Lisp already has a syntax for named parameters. Lisp hacks
> > like this for generating HTML are common.
> >
> > (table (:cellpadding "0" :cellspacing "0")
> > (tr ()
> > (td (:width "50%")
> > "Cell one")
> > (td (:width "50%")
> > "Cell two")))
>
> There are some unnecessary parens here. I submit that
> s-expression is as much about ruthlessly avoiding
> unneeded parens as about using them when needed.
>
> (table :cellpadding "0" :cellspacing "0"
> (tr
> (td :width "50%"
> "Cell one")
> (td :width "50%"
> "Cell two")))
I think the two of you are getting at the heart of the issue here.
Scott's example uses a syntax that is very easy for a Lisp program to
parse. Thus it's easy to make a variety of tools which grovel over it
is various ways. Dorai's example is less verbose (paren-bose??), but
requires a more complex program to parse. It's more in the direction of
a syntax without parens. If you wanted to make tools to grovel over it,
you'd invent a simpler intermediate representation.
That's the XML solution, of course. Of course Lisp lists are an
intermediate representation for s-expressions, too, but the connection
is more direct.
I'm not going to try to argue which is better for programmers. I will
point out that the s-expr mechanism allows you to choose different
syntaxes, within the range of syntaxes with parens and whitespace.