[Asdf-devel] Program with metaclass on MKCL.

D. Martinez denis.martinez at live.com
Thu Dec 4 11:32:53 UTC 2014


Thank you Pascal for pointing this out, but I don't think this relates to my problem.
I have looked at MKCL source and it was evident that it does not implement superclass validation at this time.
Its MOP is not supported either in Closer-MOP so I assume it is somewhat young.
Quoting for clos/standard.lsp:
  ;; FIXME!!! Here should come the invocation of VALIDATE-SUPERCLASS!
As I have played with various CLs I noted that some required VALIDATE-SUPERCLASS and some did not. I have not really checked what is the standard's stance on this.
 
I can trace the error rising from defclass to standard.lsp in mkcl.
It is the cond clause from ensure-class-using-class. I display some more information to post here.
          ((not (eq (class-of class) metaclass))
           (format *error-output* "class: ~A~%" class)
           (format *error-output* "(class-of class): ~A~%" (class-of class))
           (format *error-output* "metaclass: ~A~%" metaclass)
           (error "When redefining a class, the metaclass can not change.")))
 
Which provides this output
 
class: &<The A-CLASS A 140012460512096>
(class-of class): &<The STANDARD-CLASS A-CLASS 140012464325568>
metaclass: &<The STANDARD-CLASS A-CLASS 140012460537344>
Error during command line arguments processing:
When redefining a class, the metaclass can not change..
 
This does show that A-CLASS is intanciated twice, and it is why the EQ test fails.
The mystery is why there happen two instanciations when I use ASDF.

----------------------------------------
> To: asdf-devel at common-lisp.net
> From: pjb at informatimago.com
> Date: Thu, 4 Dec 2014 11:26:50 +0100
> Subject: Re: [Asdf-devel] Program with metaclass on MKCL.
>
> "D. Martinez" <denis.martinez at live.com> writes:
>
>> 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 at 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))
>
>
> AFAIK, you need to define a validate-superclass method when you define a
> new metaclass:
>
>
> ---- a.lisp ------------------------------------------------------------
> (in-package &:hello)
> (defclass A-class (standard-class)
> ())
> (defmethod validate-superclass ((class A-class) (super standard-class))
> t)
> (defclass A (standard-object)
> ()
> (:metaclass A-class))
> ---- hello.asd ---------------------------------------------------------
> (asdf:defsystem &:hello
> :description "Describe hello here"
> :author "Your Name <your.name at example.com>"
> :license "Specify license here"
> :serial t
> :components ((:file "package")
> (:file "a"))
> :depends-on ("closer-mop"))
> ---- package.lisp ------------------------------------------------------
> (defpackage &:hello
> (:use &:cl)
> (:import-from &:closer-mop &:validate-superclass))
> ------------------------------------------------------------------------
>
>
>> 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.
>
> I tested it with ccl.
>
> --
> __Pascal Bourguignon__ http://www.informatimago.com/
> “The factory of the future will have only two employees, a man and a
> dog. The man will be there to feed the dog. The dog will be there to
> keep the man from touching the equipment.” -- Carl Bass CEO Autodesk
>
>
> _______________________________________________
> Asdf-devel mailing list
> Asdf-devel at common-lisp.net
> http://mailman.common-lisp.net/cgi-bin/mailman/listinfo/asdf-devel
 		 	   		  



More information about the asdf-devel mailing list