[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: XML as a transition to s-expr
Lauri Alanko <la@iki.fi> writes:
> On Tue, Dec 18, 2001 at 11:38:47AM -0500, Scott McKay wrote:
> > You have over-simplified here, by cramming together two different
> > concepts: "attributes" and "bodies".
>
> If that is the case, then you also have crammed together two different
> concepts: "attribute names" and "attribute values". A plist is also a
> user-friendly simplification of an alist. If you want a "clean" syntax,
> wouldn't you prefer the one used by PLT Scheme's XML package:
>
> (table ((cellpadding "0") (cellspacing "0"))
> (tr ()
> (td ((width "50%"))
> "Cell one")
> (td ((width "50%"))
> "Cell two")))
>
> Still more verbose, but "purer".
When I was writing a markup language embedded in scheme (yes, this is
the second project everyone does after writing their own web server in
scheme), I found that the originally suggest syntax:
((table :cellpadding 0 :cellspacing 0)
((tr)
((td :width "50%") "Cell one")
((td :width "50%") "Cell two")))
had much to recommend it. The biggest advantage is that the tags
still make sense when they stand alone. For instance, you can write:
((table :cellpadding 0 :cellspacing 0)
((tr)
(map (td :align "right")
'("Cell one" "Cell two" "Cell three"))))
Now admittedly you can read and parse any sort of parenthesized
expression into something useful, but I was able to avoid writing a
parser and evaluator and I got higher-order tags out of it to boot.