|
Re: Re: New, from-scratch implementation of backquote.: msg#00074lisp.clisp.general
Kaz Kylheku <kaz@xxxxxxxxxxxxxxxxxxx> writes: > On Fri, 11 Apr 2003, Hoehle, Joerg-Cyril wrote: > > > Date: Fri, 11 Apr 2003 13:22:31 +0200 > > From: "Hoehle, Joerg-Cyril" <Joerg-Cyril.Hoehle@xxxxxxxxxxxxx> > > To: clisp-list@xxxxxxxxxxxxxxxxxxxxx > > Cc: kaz@xxxxxxxxxxxxxxxxxxx > > Subject: New, from-scratch implementation of backquote. > > > > Hi, > > > > I found the following thread from 1999 quite intriguing: > > > > Christopher R. Barry in cll on: quasiquote reference implementation > > http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=87vh8hk0dj.fsf%402xtreme.net&rnum=8 > > (defmacro defclass* (name supers slots &rest options) > > `(macrolet ((do-it () > > `(defclass ,,name ,,supers ,,slots ,,@options))) > > (do-it))) > > Interesting; basically this uses macrolet solely to obtain an extra > level of macroexpansion, so that the name, supers, slots and options > are all evaluated. Which maybe means that you probably don't want a macro, but a function instead... > [... lucid comments elided ...] > > To solve this problem you need the help of EVAL. Your loop must > actually construct the *source code* of a DEFCLASS construct into which > it has inserted all the right pieces, and then EVAL that source code > so that its effect takes place. Defining defclass* as a function avoids the need for eval: (defun defclass* (name supers slots &rest options) (funcall (lambda () `(defclass ,name ,supers ,slots ,@options)))) (loop for i from 1 to 3 collect (defclass* ( (intern (format nil "FOO-~D" i)) () ()) ------------------------------------------------------- This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: New, from-scratch implementation of backquote.: 00074, Kaz Kylheku |
|---|---|
| Next by Date: | Re: Re: New, from-scratch implementation of backquote.: 00074, Todd Sabin |
| Previous by Thread: | Re: New, from-scratch implementation of backquote.i: 00074, Kaz Kylheku |
| Next by Thread: | Re: Re: New, from-scratch implementation of backquote.: 00074, Todd Sabin |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |