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

Re: tools for exporting symbols ?



In article <19890814154758.2.MPETER@POLLUX> 
   mpeter%bernina.zir.ethz.ch@WARBUCKS.AI.SRI.COM (Martin Peter) writes:

>I have a utility package with flavors, methods, functions, var's und const's
>and I would like to export all (or at least most) of these symbols to other 
>packages.

>So I have to insert an (export '(......)) form into my utility package and a
>simmilar import form in all the other packages, but since a have many symbols
>to export/import it would be nice to have some function which generates 
>such an export list automatically.
>
>Is there an "official way" how I can get such a list ? I know that I can
>write my own function with do-symbols but maybe there's a more ellegant
>solution.

I don't know of any "official way" but I will comment that, if you were to
map over all they symbols of a package, you would have to filter out just
the symbols which are functions, methods, flavors, vars and consts.  As
an example of why this is so, consider the function below:

(defun foo (x y)
	(+ x y)
)

You probably want to export foo but not x and y.  

I can think of two approaches to accomplish this.  The first is by
mapping over the symbols in the package using filters as mentioned
above.  I have a set of functions which given a symbol determine
whether it is a function, macro or special form.  Similar functions
can probably be written for flavors, vars and consts.

The second way to do this is to create a bunch of macros which parallel
defun, defflavor, defvar, etc.  I did this by defining macros such
as defun-exported which export the function name as well as defining 
the function.

Rich



(responsible-p ADS message)
NIL
(si:halt)