Re:Erik Naggum on Attributes in SGML, XML, Lisp (2001)
by lisper on Friday May 15, 2015 @11:56AM
(#9551417)
> which has the distinct advantage that the symbol/identifier foo is not nested one level deeper
Why is that an advantage?
I actually like the aesthetics of the extra parens in the CAR. It provides a clear visual distinction between code and markup (at least in Common Lisp, where ((...) ...) is defined by the standard to be a syntax error) which I think is a feature. e.g.:
((:div :class "toplevel" :style "display:block")
(:h1 "This is a heading")
"This is content")
I think it looks kinda nice.
Alternatively you could also write (foo ((bar "zot)) quux) as it is handled in Racket's X-expressions, which has the distinct advantage that the symbol/identifier foo is not nested one level deeper, which makes reading it harder, while still preserving the 1-1 correspondence. Though in this case the meta-information is the first argument instead of being part of the identifier. It also works perfectly with stuff like <foo bar="zot" baz="zor">quux</foo>, which is read as (foo ((bar zot) (baz zor)) quux). I personally think this is way better than ((:foo :bar "zot" :baz "zor) "quux")