Just Launched: You can now import projects and releases from Google Code onto SourceForge
We are excited to release new functionality to enable a 1-click import from Google Code onto the Allura platform on SourceForge. You can import tickets, wikis, source, releases, and more with a few simple steps. Read More
From: Bruno Haible <bruno@cl...> - 2004-12-16 20:13:53
> user variable CUSTOM:*DEFINE-EXPORTING*
> initial value: NIL
> when non-nil, macroexpansion of
> DEFUN, DEFMACRO, DEFVAR, DEFCONSTANT, DEFPARAMETER, DEF-CALL-OUT
> (but not DEF-CALL-IN), DEFINE-MODIFY-MACRO, DEFINE-SYMBOL-MACRO,
> DEFSETF, DEF-C-TYPE, DEF-C-ENUM, DEF-C-STRUCT, DEF-C-VAR,
> DEFSTRUCT, DEFCLASS
> will contain an EXPORT form for the symbol defined:
> (EXPORT ',name ,(symbol-package name))
> the variable is checked only at macroexpansion time,
> so when loading a compiled file its value has no effect.
> use case:
> (eval-when (compile eval)
> (setq custom:*define-exporting* t))
> (defvar foo 10)
> (defun bar (x) (+ x foo))
> NOTE: slot accessors (but not slot names) for DEFCLASS, DEFSTRUCT,
> DEF-C-STRUCT, are also exported.
> NOTE: constants defined by DEF-C-ENUM are also exported.
I'm more in favour of an extra package that exports the symbols
EXPORTING:DEFUN, EXPORTING:DEFMACRO, etc.
- It allows leaving the ANSI CL macros unmodified.
- It allows using some of the exporting macros but not all.
- It allows using the non-exporting macro in selected places.
(:shadowing-import-from "EXPORTING" #:defun #:defmacro #:defvar))
(defvar foo 10)
(defun bar (x) (+ x foo))
; This one I don't want to export.
(cl:defun private-password () "as7djqkw")
> (but not DEF-CALL-IN)
Why not? When the called-in function is a generic function, it makes sense
to let other packages attach methods to it; therefore its name should be
From: Sam Steingold <sds@gn...> - 2004-12-16 20:41:48
> * Bruno Haible <oehab@...> [2004-12-16 21:12:11 +0100]:
> I'm more in favour of an extra package that exports the symbols
> EXPORTING:DEFUN, EXPORTING:DEFMACRO, etc.
as long as they look like
(defmacro exporting:defun (name &rest body)
`(progn (cl:defun ,name ,@body)
(cl:export ',name ,(find-package name))))
i.e., do not re-implement the original functionality.
note that DEFSTRUCT, DEFCLASS, DEF-C-STRUCT will need to use MOP to get
the list of readers, writers and accessors to export.
PS note that PARI uses modern package mode; I suggest that as you remove
exporting.lisp, you convert all those modules to modern mode.
PPS I suggest :MODERN argument for DEFPACKAGE/MAKE-PACKAGE.
when set, it should forbid :CASE-SENSITIVE & :CASE-INVERTED arguments
and convert CL in :USE to CS-CL. I.e.,
(make-package "FOO" :modern t :use '(#:cl #:ext))
is equivalent to
(make-package "FOO" :case-inverted t :case-sensitive t
:use '(#:cs-cl #'ext))
this might make it easier to write code portable between ACL and CLISP.
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>