Hello. Being new to "serious" CL programming I am hitting a brick wall right now in one CLOS project.
After some time of infructuous searching I cannot find the source of my problem, which may be of either MKCL or ASDF but I lack the knowledge to debug this. Mr. JCB, who I have seen active on this list, may (hopefully!) be able to shed some light on the issue.
The bug I encounter happens when I load the project by the means of ASDF. I can not reproduce it otherwise.
It is triggered by a use of a custom metaclass, and it suggests that a file is loaded more times than it should.
I have narrowed down the problem to a small program, so here it is:
;;;; hello.asd
(asdf:defsystem #:hello
:description "Describe hello here"
:author "Your Name <your.name(a)example.com>"
:license "Specify license here"
:serial t
:components ((:file "package")
(:file "a"))
:depends-on ())
;;;; package.lisp
(defpackage #:hello
(:use #:cl))
;;;; a.lisp
(in-package #:hello)
(defclass A-class (standard-class)
())
(defclass A (standard-object)
() (:metaclass A-class))
* Case 1: load with MKCL only: mkcl -load package.lisp -load a.lisp
OK, works as expected.
* Case 2: compile with MKCL only and load: mkcl -load package.lisp -compile a.lisp
OK, it produces a fas (shared library). I load it from REPL. It works.
* Case 3: load or build with ASDF
It fails (at the definition of class A). The error message is this:
-> When redefining a class, the metaclass can not change..
It acts as if a.lisp was actually loaded twice. Same error as loading a twice in a row, as by this command.
mkcl -load package.lisp -load a.lisp -load a.lisp
My ASDF command: (asdf:operate 'asdf:load-op :hello)
Same problem with compile-op and program-op. However, load-source-op does work without problem.
(I always make sure to clear cache between asdf operations)
I will happily provide more specific info at request. The bug occured on MKCL 1.1.9 and 1.1.10 git with bundled ASDF.