|
From: Vitaly M. <v.m...@gm...> - 2009-08-05 17:38:16
|
At Wed, 5 Aug 2009 19:07:49 +0300, Nikodemus Siivola wrote: > Yes, it's a but -- but I believe a bug in CFFI. Explanation follows. > (Example demonstrating an alternative way to trigger comes right at > the end.) > > In the expansion, this is the problematic form: > > (DEFMETHOD (SETF MY-STRUCT-FOO) ((INST MY-STRUCT) NEW) > (SETF (CFFI:FOREIGN-SLOT-VALUE (SLOT-VALUE INST 'RAW) 'MY-STRUCT > 'FOO) > NEW)) > > first off, this probably does not do what you think it does: the new value is > the first argument, not the last. Yes, it is correct in my code, I did a typo in this smaller piece of code. > Notice how the same error can be provoked without the PCL code walker: > > (defun my-bad (x z) > (setf (cffi:foreign-slot-value (let ((y (x-y x))) > (y-foreign y)) > 'my-struct > 'foo) > z)) > > Unless the contract of (SETF FOREIGN-SLOT-VALUE) is that the first > (second) argument > must be a settable place itself, the compiler-macro is broken. Ok, thanks for explanation. -- wbr, Vitaly |