[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XML as a transition to s-expr



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".
> How, in your example below,
> is a program supposed to know that :width 50% is not part of
> the body?  If there is a "coercion" from keywords (like :width)
> to strings, then how would you interpret your example.

Coercion? What coercion? Dorai's syntax (which, as it happens, is _exactly_
the syntax that I also use for representing XML with sexprs) is unambiguous,
as long as you can recognize keywords. Even if the lisp/scheme
implementation doesn't support separate keyword objects, one can merely
define that an attribute name is represented by a symbol that begins with a
colon.

I think there should be a distinction made here between the data structure
used to _manipulate_ documents, and the syntax used to read and write them.
IMHO, for reading and writing, the syntax should be as readable and
uncluttered as possible. But an s-expr of this form can then be trivially
"parsed" and converted either into a more regular list structure, or into a
special data object (usually a "struct") intended solely for representing
those documents. Those are then easier for programs to operate upon. Thus
you get the best of both worlds.


Lauri Alanko
la@iki.fi