Lisp HUG Maillist Archive

Bug: reinitialization of generic functions

Hi,

Here is a bug report wrt reinitialization of generic functions. The  
CLOS MOP specification states that if the lambda list of a generic  
function is reinitialized, but no argument precedence order is given,  
then the argument precedence order has to be initialized with the  
list of required arguments in the lambda list. However, the following  
code doesn't work correctly in LispWorks (4.4.6 on Mac OS X):

(let ((gf (make-instance 'standard-generic-function
                          :lambda-list '(a b c)
                          :argument-precedence-order '(c b a))))
   (assert (equal (clos:generic-function-argument-precedence-order gf)
                  '(c b a)))
   (reinitialize-instance gf :lambda-list '(a b c))
   (assert (equal (clos:generic-function-argument-precedence-order gf)
                  '(a b c))))


A slight change makes this code succeed:

(let ((gf (make-instance 'standard-generic-function
                          :lambda-list '(a b c &optional o)
                          :argument-precedence-order '(c b a))))
   (assert (equal (clos:generic-function-argument-precedence-order gf)
                  '(c b a)))
   (reinitialize-instance gf :lambda-list '(a b c &rest r))
   (assert (equal (clos:generic-function-argument-precedence-order gf)
                  '(a b c))))


So my guess is that LispWorks checks whether the lambda list is  
changed compared to its previous value and skips reinitialization if  
that's the case. However, it should check for the argument precedence  
order as well.


Cheers,
Pascal

-- 
Pascal Costanza, mailto:pc@p-cos.net, http://p-cos.net
Vrije Universiteit Brussel, Programming Technology Lab
Pleinlaan 2, B-1050 Brussel, Belgium





Updated at: 2020-12-10 08:48 UTC