An idea for making define-macro more convenient to use
From: Sunnan (sunnan_at_handgranat.org)
Date: 02/25/05
- Next message: David Steuber: "Re: why not enough lisp libraries?"
- Previous message: William Bland: "Re: why not enough lisp libraries?"
- Next in thread: Kaz Kylheku: "Re: An idea for making define-macro more convenient to use"
- Reply: Kaz Kylheku: "Re: An idea for making define-macro more convenient to use"
- Reply: Taylor Campbell: "Re: An idea for making define-macro more convenient to use"
- Reply: Kent M Pitman: "Re: An idea for making define-macro more convenient to use"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 25 Feb 2005 00:20:48 GMT
How about making a version of define-macro (with another name) where
variables introdued are in their own separate namespace (for a broad
enough definition of the word "namespace"), and had to be explicitly
converted if we wanted to expose them?
E.g. in my-or (from _Teach Yourself Scheme_), "temp" would be in it's
own "macro-namespace" so that the following would be ok:
(define-macro* my-or
(lambda (x y)
`(let ((temp ,x))
(if temp temp ,y))))
This could be a wrapper for using gensyms, so that it would expand to:
(define-macro my-or
(lambda (x y)
(let ((temp (gensym)))
`(let ((,temp ,x))
(if ,temp ,temp ,y)))))
If we wanted to deliberately introduce variables, we could wrap them in
a function to "convert" them from the "macro-namespace":
(define-macro* my-weird-or
(lambda (x y)
`(let (((capture temp) ,x))
(if temp temp ,y))))
could expand to:
(define-macro my-weird-or
(lambda (x y)
`(let ((temp ,x))
(if temp temp ,y))))
- Next message: David Steuber: "Re: why not enough lisp libraries?"
- Previous message: William Bland: "Re: why not enough lisp libraries?"
- Next in thread: Kaz Kylheku: "Re: An idea for making define-macro more convenient to use"
- Reply: Kaz Kylheku: "Re: An idea for making define-macro more convenient to use"
- Reply: Taylor Campbell: "Re: An idea for making define-macro more convenient to use"
- Reply: Kent M Pitman: "Re: An idea for making define-macro more convenient to use"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]