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

Re: More concrete remarks on &keywords...



GSB: Personally, I think your LSB syntax suffers from the fact that the keyword
 information is sticky. I still think that's a disadvantage. I would prefer to
 make required args after optionals illegal or simply fill in optionals from
 left to right. eg,
   (defun f (x (opt y) z (opt w)) ...)
	(f a b) => x:a, z:b
	(f a b c) => x:a, y:b, z:c
	(f a b c d) => x:a, y:b, z:c, w:d
   (defun f (x (rest y) z (opt w)) ...)
	(f a b) => x:a, z:b
	(f a b c) => x:a, z:b, w:c
	(f a b c d) => x:a, y:(b), z:c, w:d
	(f a b c d e) => x:a, y:(b c), z:d, w:e
 tho' I can perfectly well understand why people might not want to do this and
 I would have no interest in pushing it ... making these odd cases illegal 
 wouldn't bother me.

RMS: Let's assume a parser were ok. Doesn't (OPTIONAL) suffer from the 
 need for a way to specify defaults. Eg,
	(defun f (x y (optional) (z 3) (zz) (rest) q) ...)
 doesn't let you tell what a keyword is. Perhaps MDL's idea of strings 
 would be a better one if you want to go this route. (Maclisp could be
 made to win even with "..." becoming a symbol in the current default environ
 since the symbol is tagged with a +internal-string-marker property...)

I do have application for and would really like to see (I am re-entering
the real world here, no longer speculating) a canonical form which programs
could easily map over, and some primitive available to turn things into that
form (the same primitive and canonical form in each dialect would be helpful)
so that I could do something like:

	(PARSE-DEFUN-ARGLIST '(FOO &OPTIONAL &QUOTE (X 3) &EVAL Z &REST BAR))
	    => (FOO (OPTIONAL (QUOTE X) 3) (OPTIONAL Z) (REST BAR))
and
	(FORM-DEFUN-ARGLIST
	     '(FOO (OPTIONAL (QUOTE X) 3) (OPTIONAL Z) (REST BAR)))
	    => (FOO &OPTIONAL &QUOTE (X 3) &EVAL Z &REST BAR)

This would guarantee that people would never have to write their own parsers
for these things and that in spite of whatever hacks had been done to make the
bvl more visually aesthetic (eg, &keywords), there would be a standard 
interpretation defined by this set of conversion primitives. Hence, one could 
write

	(DEFMACRO DEFINE (NAME-STUFF ARG-LIST &REST BODY)
	  `(DEFUN ,NAME-STUFF ,(FORM-DEFUN-ARGLIST ARG-LIST) ,@BODY))
	(DEFINE F (X (OPTIONAL Y)) ...)

and win just as well as those people who prefer the &notation or whatever 
notation alternative notation FORM-DEFUN-ARGLIST produces. Further, although
programs can't do

	(MAPCAR #'(LAMBDA (ELT) ...) ARG-LIST)

when doing code-transformations, compilations, etc., they could do

	(MAPCAR #'(LAMBDA (ELT) ...) (PARSE-DEFUN-ARGLIST ...))

and still win -- and I don't consider this to be an excessive cost since only
one parser function would have to be kept up to date -- the system version.
-kmp