[Ecls-list] Two bugs in ECL's CLOS implementation
Pascal Costanza
pc at p-cos.net
Sat Nov 28 12:24:05 UTC 2009
On 27 Nov 2009, at 22:42, Juan Jose Garcia-Ripoll wrote:
>> Showstopper:
>> [...]
>>> (clos:set-funcallable-instance-function #'test (lambda (a b c) (* a b c)))
>> [...]
>>> (defmethod test (a b c) (+ a b c))
>> Detected access to an invalid or protected memory address.
>
> CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION has to change the structure of
> the generic function to store the dispatch function somewhere.
> Unfortunately I forgot to copy a field, instance.sig, which is used
> to determine when instances become obsolete and when they have been
> initialized.
>
> Both are fixed in CVS. Thanks a lot for reporting and taking the time
> to write small test cases!
Thanks a lot indeed for fixing those. I now get much farther with Closer to MOP than before.
However, another issue occurred:
> (use-package :clos)
T
> (defgeneric foo (x y z))
#<STANDARD-GENERIC-FUNCTION FOO>
> (set-funcallable-instance-function #'foo (lambda (x y z) (+ x y z)))
#<STANDARD-GENERIC-FUNCTION FOO>
> (defun test ()
(apply #'foo (list 1 2 3)))
TEST
> (test)
#<bytecompiled-closure #<bytecompiled-function 0000000101e00000>> is not of type FUNCTION.
Available restarts:
1. (RESTART-TOPLEVEL) Go back to Top-Level REPL.
Broken at TEST. In: #<process SI:TOP-LEVEL 00000001005c0f60>.
>> :r1
> (defun test ()
(funcall #'foo 1 2 3))
TEST
> (test)
6
Apparently, ECL has problems with APPLYing generic functions that have been modified by way of set-funcallable-instance-function. This seems to be independent of whether code is compiled or byte-compliled.
Pascal
--
Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
Vrije Universiteit Brussel
Software Languages Lab
Pleinlaan 2, B-1050 Brussel, Belgium
More information about the ecl-devel
mailing list