[Openmcl-devel] Generating a warning when loading fasls with duplicate function definitions

Gary Byers gb at clozure.com
Wed Jul 11 00:50:53 PDT 2012


If CCL:*WARN-IF-REDEFINE* is true when a duplicate definition is
loaded (from source or fasl), you'll get a warning of the form:

; Warning: FUNCTION X previously defined in: home:a.lisp.newest is now being redefined in: home:b.lisp.newest

Such a warning can certainly be useful; it can also be annoying.
(It's sometimes necessary/desirable to define simple versions of
things that run early in the process of bootstrapping a large system
and are replaced with more feature-rich versions when it's possible
to define such versions.)

*WARN-IF-REDEFINE* was present (with pretty much current semantics) in
MCL 25 years ago, and I think that I personally found it annoying far
more often than I found it useful.  I changed the default value to
NIL in OpenMCL/CCL at some point in the dim past and have managed
to completely forget about it, so thanks.  Thanks a lot ...

(I don't have a serious objection to changing the default value to T,
at least experimentally.)

One thing that CCL and its ancestors have never tried to detect and warn
about is the case where something's defined more than once in the same
file.  This probably doesn't happen too often but probably isn't too
hard to check for, and warning when it does happen could be worthwhile.
(Or could be annoying.)



On Tue, 10 Jul 2012, Burton Samograd wrote:

> Say I have x.lisp:
>
> (defun x (x) (* x x))
>
> and x2.lisp:
>
> (defun x (x) (* x x x))
>
> Compile both of the files:
>
> (compile-file "x.lisp" :output-file "x.lo")
> (compile-file "x2.lisp" :output-file "x2.lo")
>
> and then load them:
>
> (load "x.lo")
> (load "x2.lo")
>
> No warning is printed about the redefinition of the function x when
> x2.lo is loaded.  Is there a way to get CCL to print a warning message
> when such a redefinition occurs (as SBCL does)?
>
> --
> Burton Samograd
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list