[closer-devel] [PATCH] make defpackage form fully describe package's state

Tobias C. Rittweiler tcr at freebits.de
Tue Sep 15 17:08:13 UTC 2009


Uhm, for some reason that escapes me, the diff below came in
reversed. You have to apply it by passing the -R flag to patch.

  -T.

"Tobias C. Rittweiler" <...> writes:

> CLHS specifies that consequences are undefined if a defpackage form (on
> evaluation) does not fully describe the package's state. And, indeed,
> SBCL signals a warning in that case.
>
> That means that (progn (asdf:oos 'asdf:load-op :closer-mop :force t)
>                        (asdf:oos 'asdf:load-op :closer-mop :force t))
> will fail on SBCL.
>
> The attached patch makes the effort to generate a DEFPACKAGE form which
> correctly describes the final state of the package it defines.
>
>   -T.
>
>
> --- old-closer-mop/closer-mop-utility-packages.lisp	2009-09-15 17:58:23.000000000 +0200
> +++ new-closer-mop/closer-mop-utility-packages.lisp	2009-09-15 17:58:23.000000000 +0200
> @@ -1,22 +1,17 @@
>  (in-package :cl-user)
>  
> -;;; We have to make sure that the DEFPACKAGE form fully describes the
> -;;; state of the package as CLHS specifies the consequences to be
> -;;; undefined otherwise. And SBCL annoyingly^W rightfully signals
> -;;; a warning in the case of reloading.
> -(macrolet
> -    ((define-closer-cl-package (name &body options)
> -         `(defpackage ,name
> -              , at options
> -            (:export ,@(loop for sym being the external-symbols of :common-lisp
> -                             if (find-symbol (symbol-name sym) :c2mop)
> -                               collect it
> -                             else collect sym))
> -            (:export ,@(loop for sym being the external-symbols of :c2mop
> -                             collect sym)))))
> -  
> -  (define-closer-cl-package #:closer-common-lisp
> -      (:nicknames #:c2cl)))
> +(defpackage #:closer-common-lisp
> +  (:nicknames #:c2cl)
> +  (:use))
> +
> +(let ((syms (nunion (loop for sym being the external-symbols of :common-lisp
> +                          if (find-symbol (symbol-name sym) :c2mop)
> +                          collect it
> +                          else collect sym)
> +                    (loop for sym being the external-symbols of :c2mop
> +                          collect sym))))
> +  (import syms :c2cl)
> +  (export syms :c2cl))
>  
>  (defpackage #:closer-common-lisp-user
>    (:nicknames #:c2cl-user)





More information about the closer-devel mailing list