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

Access to lexical environment?



Creating new syntax using Lisp -- access to lexical environment?

I am not sure how to properly develop simple extensions to Lisp
syntax (using CL).  For example, suppose that I'd like to set up a
way to create new things that has the following (familiar) syntax:

(def-newthing fred (other-thing) ((n :initform (+ a b))
                                  (ls :initform (rest ls1)))
                                 ...etc.)

Now a,b, and ls1 would typically be lexically scoped.  Given this, how
do I define "def-newthing"?  If I use defun, it will attempt to
evaluate (other-thing), and worse, ((n :initform ....)).  This won't
work.  If I use defmacro, when I pull out an initform to evaluate, such
as (+ a b), the defmacro won't allow me access to the lexical bindings
of a and b.  eval has similar problems. I'm stuck.  Any ideas?  (There
might be a lisp group to send this to, but we don't subscribe --
anyway, I have confidence that I'll be enlightened on this by sluggers.)

   Bob Futrelle
   College of Computer Science  161CN
   Northeastern University
   360 Huntington Ave.
   Boston, MA 02115

   (617)-437-2076
   CSNet: futrelle@corwin.ccs.northeastern.edu