[Openmcl-devel] Another spurious compiler warning (in 1.7)

Zach Beane xach at xach.com
Tue Dec 13 19:19:15 UTC 2011


Bit Twiddler <bitwiddler at gmail.com> writes:

> Compiling Mcclim again, I have run up against the following:
>
> more test-initargs.lisp
> (in-package :cl-user)
>
> (defclass testclass () (
>   ; of the form ((start . stop) font translator)
>   (slot-1
>     :initarg  :ascent
>     :reader slot-1
>     )
>   (slot-2
>     :initarg  :ascent
>     :reader slot-2
>     )
>   (slot-3
>     :initarg  :ascent
>     :reader slot-3
>     )
>   (slot-4
>     :initarg  :ascent
>     :reader slot-4
>     )))
>
> (defun makeit (initial-value)
>   (make-instance 'testclass :ascent initial-value))
>
> (defun testit ()
>   (let ((test-instance (makeit 44)))
>     (format t "slot-1 = ~S ~%" (slot-1 test-instance))
>     (format t "slot-2 = ~S ~%" (slot-2 test-instance))
>     (format t "slot-3 = ~S ~%" (slot-3 test-instance))
>     (format t "slot-4 = ~S ~%" (slot-4 test-instance))))
>
>
> When I compile it, this is what the compiler says:
>
> ~/p/cl/test/ccl$ ccl
> Welcome to Clozure Common Lisp Version 1.7-r14925M  (LinuxX8664)!
> ? (load "test-initargs")
> ; Warning: Initarg :ASCENT occurs in both SLOT-1 and SLOT-2 slots
> ; While executing: (:INTERNAL CCL::CANONICALIZE-SLOT-SPEC DEFCLASS),
> in process listener(1).
> ; Warning: Initarg :ASCENT occurs in both SLOT-2 and SLOT-3 slots
> ; While executing: (:INTERNAL CCL::CANONICALIZE-SLOT-SPEC DEFCLASS),
> in process listener(1).
> ; Warning: Initarg :ASCENT occurs in both SLOT-3 and SLOT-4 slots
> ; While executing: (:INTERNAL CCL::CANONICALIZE-SLOT-SPEC DEFCLASS),
> in process listener(1).
> #P"/mnt/data1/home1/dsm/p/cl/test/ccl/test-initargs.lisp"
> ? (testit)
> slot-1 = 44
> slot-2 = 44
> slot-3 = 44
> slot-4 = 44
> NIL
> ?
>
> In my cursory reading of CLTL2, section 28.1.9.1, (p802), using an
> :initarg for multiple
> slots would appear to be legal, but I am not an expert.
>
> There is the sentence:
>
> "A single initialization argument can initialize more than one slot."

For what it's worth, CLTL2 is not the standard. But this sentence is
also in the actual standard, in section 7.7.1, "Initialization
Arguments".

Zach



More information about the Openmcl-devel mailing list