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

suggestion: a shorter convenience form



A problem with define-syntax+syntax-case is that you
get very verbose syntax definitions, with lots of
standard boiler-plate.  This makes syntax definitions
needlessly hard to read and (less important) more tedious to
write.  This has tempted some of my Kawa users to use the "legacy"
non-hygienic define-macro form, even though I discourage it.
Even plain R5RS define-syntax+syntax-rules is
ridiculously verbose.

One idea I had has this little conveniece macro:

(define-syntax define-syntax-case
   (syntax-rules ()
     ((define-syntax-case name literals . parts)
      (define-syntax name
        (lambda form
         (syntax-case form literals . parts))))))

Typical use - especially nice if #` is availiable:

(define-syntax-case NAME ()
  ((_ PVAR ...)
  #`(... PVAR ...))

Of course people can define this themselves, but
it is nicer if it is standard, because then people
get used to reading it.
--
	--Per Bothner
per@xxxxxxxxxxx   http://per.bothner.com/