Hi,
a package defines structures for the rest of the system, and a few
basic functions to operate on them. I want it to export all symbols
defined in it. Is
(defmacro EXPORT-SYMBOLS ()
"export all symbols defined in the current package" '(do-symbols
(sym)
(when (eq (symbol-package sym) *package*)
(export sym))))
the right way to do that?
David
············@gmail.com wrote:
> a package defines structures for the rest of the system, and a few
> basic functions to operate on them. I want it to export all symbols
> defined in it.
you want to use
<http://clocc.sourceforge.net/clocc/src/ext/exporting/exporting.lisp>
············@gmail.com wrote:
> Hi,
>
> a package defines structures for the rest of the system, and a few
> basic functions to operate on them. I want it to export all symbols
> defined in it. Is
>
> (defmacro EXPORT-SYMBOLS ()
> "export all symbols defined in the current package" '(do-symbols
> (sym)
> (when (eq (symbol-package sym) *package*)
> (export sym))))
>
> the right way to do that?
Probably not, especially because what you say is also probably not what
you want. Under the assumption that the above code is executed in the
said package, for example SYM will also be exported because it's also a
symbol interned in that package. (I am talking about the local variable
used in your macro.)
It's better to be explicit about what you export, even if it seems
tedious at first. If you want something more implicit, you could
consider defining some macros like, say, DEFINE-EXPORTED-FUNCTION that
expands into a DEFUN and a respective EXPORT.
Pascal
--
The big bang way only works for god, everybody else has to use
evolution. - David Moon