In release 19a, there seems to be a problem with compiled calls to
MAKE-INSTANCE for classes for which (1) an :INIT-ARG keyword is a normal
symbol (rather than a keyword symbol), and (2) there is an :AFTER-method on
INITIALIZE-INSTANCE for that class.

The problem is reproducable.  A log is below.

The problem seems to be that the :INIT-ARG key form 'C in 

  (MAKE-INSTANCE 'A 'C 17)

below is evaluated twice, first when the ctor information is gathered, and
again when the ctor is called.  Or some such.

As a work-around, I have temporarily disabled MAKE-INSTANCE in my
.cmucl-init.

Thanks for any help.

Cheers,
Axel

======================================================================

[EMAIL PROTECTED]:/tmp> cat test.lisp 
(defclass a () ((c :initarg c)))

(defmethod initialize-instance :after ((x a) &rest initargs 
                                       &key &allow-other-keys)
  (declare (ignore initargs))
  t)

(defun make-a (argument) (make-instance 'a 'c argument))
[EMAIL PROTECTED]:/tmp> lisp -noinit
CMU Common Lisp 19a, running on poulenc
With core: /usr/local/lib/cmucl/lib/lisp.core
Dumped on: Wed, 2004-07-28 18:51:48+02:00 on lorien
See <http://www.cons.org/cmucl/> for support information.
Loaded subsystems:
    Python 1.1, target Intel x86
    CLOS based on Gerd's PCL 2004/04/14 03:32:47
* (load "test.lisp")

; Loading #p"/tmp/test.lisp".
; Compiling LAMBDA (PCL::.PV-CELL. PCL::.NEXT-METHOD-CALL. X PCL::.REST-ARG.): 
; Compiling Top-Level Form: 
T
* (make-a 17)

#<A {580D7165}>
* (compile-file "test")

; Python version 1.1, VM version Intel x86 on 05 AUG 04 04:51:37 pm.
; Compiling: /tmp/test.lisp 05 AUG 04 03:23:56 pm

; Compiling DEFMETHOD INITIALIZE-INSTANCE :AFTER (A): 
; Compiling Load Time Value of (PCL::ENSURE-CTOR '(PCL::CTOR A C ...) 'A ...): 
; Converted MAKE-A.
; Compiling DEFUN MAKE-A: 
; Byte Compiling Top-Level Form: 

; test.x86f written.
; Compilation finished in 0:00:00.

#p"/tmp/test.x86f"
NIL
NIL
* (load "test.x86f")

; Loading #p"/tmp/test.x86f".
T
* (make-instance 'a 'c 17)

#<A {582151D5}>
* (make-a 17)

; In:
;     FUNCTION (KERNEL:INSTANCE-LAMBDA (PCL::|.P0.|)
;            (LET #
;              #
;              # ..

;   (LIST PCL::.INSTANCE. C PCL::|.P0.|)
; Warning: Undefined variable C
; ; 

; Warning: This variable is undefined:
;   C
; 

; Compilation unit finished.
;   2 warnings


Error in KERNEL::UNBOUND-SYMBOL-ERROR-HANDLER:  the variable C is unbound.
   [Condition of type UNBOUND-VARIABLE]

Restarts:
  0: [ABORT] Return to Top-Level.

Debug  (type H for help)

((MAKE-INSTANCE A C PCL::|.P0.|) 17)
Source: (LIST PCL::.INSTANCE. C PCL::|.P0.|)
0] 


Reply via email to