[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: XML as a transition to s-expr
From: Tony Kimball <firstname.lastname@example.org>
Date: Tue, 18 Dec 2001 17:28:56 -0600
Quoth Scott McKay on Tuesday, 18 December:
: And as I already pointed out in another, this is ambiguous, since it does
: not differentiate between element attributes and element bodies.
Disagree. It's quite clear what is an attribute, and
what is content: (defun tag1 (&key attr1 &rest body) ... )
Hm. What dialect of Lisp is that from?
In Common Lisp,
(a) &rest must precede &key, and
(b) the &rest gets the *same* arguments in its list that &key
gets to process. Thus
(defun foo (a &rest x &key baz) (list a x baz))
(foo 1 :baz 3) => (1 (:baz 3) 3)
(Yes, it's weird that the same argument can be processed by two
different binding widgets. But CLTL2 talks about it explicitly
see page 78.)
Yes, *someone* has to parse it. But that is always true.
You'd need a rule that the body can't contain (or at least
begin with) a keyword. That might be an okay rule, but it
needs to be stated.