Subject: Re: XEXPR needs Schemers' help
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 30 Dec 2000 07:07:12 GMT
Newsgroups: comp.lang.scheme
Message-ID: <92k1j0$jbo29$1@fido.engr.sgi.com>
Barry Margolin  <barmar@genuity.net> wrote:
+---------------
| I agree.  XML syntax is horrible.  People who program in more conventional
| languages complain about all the parentheses in Lisp syntax, but XEXPR is
| even worse with all its angle brackets.  Compare:
|     (define (square x)
|       (* x x))
| with:
|     <define name="square" args="x">
|       <multiply><x/><x/></multiply>
|     </define>
| You can barely see the variables in all that </> garbage!
+---------------

Heh, heh! You haven't even scratched the surface, Barry! Your suggested
syntax breaks down when more complicated functions and expressions have
to be used. I took a try at this a while back, and the best I could come
up with that was in the spirit of XML as a "structure" representation was
to make the major tags be the basic forms of Scheme, and then have subtags
for *every* subform, so you can have lists of them. E.g.:

	<define-procedure>
	  <name>square</name>
	  <args>
	    <arg>x</arg>
	  </args>
	  <body>
	    <application>
	      <proc>*</proc>
	      <arg>x</arg>
	      <arg>x</arg>
	    </application>
	  </body>
	</define-procedure>

Artificially ugly? I don't think so. Consider defining procedures of
more than one argument, or variadic procedures, or anonymous procedures
(lambdas), and then consider things like cond & case, and procedure calls
with general expressions in the operator position, etc. The only way I
can think to "clean it up" is to drop the structural information altogether,
and make whitespace significant (both of which violate the "spirit of XML"
as I understand it):

	<list>define<list>square x</list>
	  <list>* x x</list></list>


-Rob

-----
Rob Warnock, 31-2-510		rpw3@sgi.com
SGI Network Engineering		http://reality.sgi.com/rpw3/
1600 Amphitheatre Pkwy.		Phone: 650-933-1673
Mountain View, CA  94043	PP-ASEL-IA