macro returning more than one form

Steve Haflich shaflich at gmail.com
Fri Mar 14 16:24:51 UTC 2014


You don't show what you did, and what the two implementations complained
about.  Indeed, progn is the usual way to have a macro return multiple
forms.  progn is defined not to affect the top-level-ness or
not-top-level-ness of the current environment.

But I'll make a guess what's wrong.  The in-package form changes the value
of *package*, which affects where the reader interns symbols, but your
defun form is _not_ subsequently processed by the reader.  The symbols in
the defun are already interned symbols, not strings, and are interned in
whatever package they were read into when the reader saw them.

HTH


On Fri, Mar 14, 2014 at 8:45 AM, Paul Tarvydas <paultarvydas at gmail.com>wrote:

> What is the best way to write a macro that returns more than one form to
> the top level?  E.g.
>
> (in-package :xxx)
> (defun ...)
>
> I've been wrapping a progn around the result, but LW doesn't like it very
> much, and SBCL seems to hate it.
>
> Thanks
> pt
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/pro/attachments/20140314/f9d41a9e/attachment.html>


More information about the pro mailing list