Craig Lanning <[EMAIL PROTECTED]> writes:
> If I change the line above to:
> (return (values args t)))))
>
> It works just fine.
Argh, sorry for that :/.
BTW, there was another bug in the code, and I've settled on the
following fix, now (and I've double-checked that it actually compiles
and works with Dietz' ANSI tests :):
(in-package :pcl)
(defun call-ctor (class initargs)
(flet (;;
;; Return two values ARGS, MATCH-P. ARGS is a list of values
;; from INITARGS with which the ctor can be invoked. MATCH-P
;; true means the ctor can be used.
(call-args (ctor)
(collect ((args))
(let ((ctail (ctor-initargs ctor))
(itail initargs))
(loop
(when (or (null ctail) (null itail))
(return (values (args) (and (null ctail) (null itail)))))
(unless (eq (pop ctail) (pop itail))
(return nil))
(let ((ival (pop itail)) (cval (pop ctail)))
(if (constantp cval)
(unless (eql cval ival)
(return nil))
(args ival))))))))
;;
;; Loop over all ctors of CLASS looking for a ctor that can be
;; used to construct an instance with the given initargs. If one
;; is found, invoke it and return its value.
(dolist (ctor (plist-value class 'ctors))
(when (eq (ctor-state ctor) 'optimized)
(multiple-value-bind (args match-p)
(call-args ctor)
(when match-p
(return (apply ctor args))))))))
On a different note: You mentioned a warning that would like to get
rid of. Could you please try to make a simple test case for that?