Lisp HUG Maillist Archive

Re: Request for help: top-level-form

I wrote:
> > From: "Nick Levine" <ndl@ravenbrook.com>
> > I have a macro that looks something like this:
> >
> >     (defmacro def-wombat (name)
> >       (let* ((setf-p (consp name))
> >      (underlying-name (if setf-p (cadr name) name))
> >      (modified-name (intern (format nil "FROB-~a"
> >                                     underlying-name))))
> > `(progn
> >    ...
> >    ,(if setf-p
> > `(defun (setf ,modified-name) (new-value)
> >    ...)
> >       `(defun ,modified-name nil
> > ...)))))
> >
> > I want meta-dot on name to work, so I tried replacing the progn
> > with
> >   (top-level-form ,name ...)
> >
> > I then edit foo.lisp, which contains a (def-wombat wibble), click
> > on
> > the wibble and go meta-dot.  I get
> >      Cannot find (DEFUN WIBBLE) in foo.lisp
> >
> > What am I doing wrong?
>
> You need to mention DEF-WOMBAT within the LW:TOP-LEVEL-FORM. Try
> > this:
>
>   `(lw:top-level-form (def-wombat ,name) ...)
>

Whoops.

Also, you need this:

(dspec:define-dspec-alias define-wombat (name)
  `(defparameter ,name))

It's also possible to make things work in situations where the
definition needs more than just a name to define it (as is the case
with methods, which need specializers). If you need that let me know.

Simon.



Re: Request for help: top-level-form

Unable to parse email body. Email id is 984

Updated at: 2020-12-10 09:00 UTC