[cffi-devel] Re: setf-expander of FOREIGN-SLOT-VALUE

Luis Oliveira luismbo at gmail.com
Sun Sep 25 20:07:33 UTC 2005


Marco Gidde <marco.gidde at tiscali.de> writes:
> At least two more expanders should also be corrected:
>
> (define-setf-expander mem-ref (ptr type &optional (offset 0) &environment env)
>   "SETF expander for MEM-REF that doesn't rebind TYPE.
> This is necessary for the compiler macro on MEM-SET to be able
> to open-code (SETF MEM-REF) forms."

Yes, thanks for the bug report! Things get a bit messier than your fix
though because, like that docstring above says, we don't want to rebind
the type (when it's constant) otherwise the compiler macro on MEM-SET
won't kick in. The same applies for all the other setf expanders.


> I guess the implementation dependend setf-expanders for %mem-ref
> should also be adapted. It's quite easy: instead of the first example
> in the CLHS take second ;-)

Yeah, that second example was most helpful. :-)

Anyway, this should be fixed now and I added a couple of regression
tests too. Thanks again. Changelog follows (with an unrelated tweak to
load-foreign-library to accept pathnames, as pointed out by Kenny).


Sun Sep 25 20:36:02 WEST 2005  Luis Oliveira <loliveira at common-lisp.net>
  * Fixed bogus getters in setf expanders.
  
  Bug report and initial bugfixes courtesy of Marco Gidde.
  
  - fixed setf expanders for mem-ref, mem-aref, and foreign-slot-value.
    (also mem-aref was evaluating the type argument twice)
  - likewise fixed cmucl's, openmcl's and sbcl's setf expanders for %mem-ref.
  - regression tests: mem-aref.eval-type-x2, mem-ref.nested, mem-aref.nested
    and struct.nested-setf.

Sun Sep 25 05:42:42 WEST 2005  Luis Oliveira <loliveira at common-lisp.net>
  * load-foreign-library
  
  - extend load-foreign-library to accept a pathname as an argument.
  - change tests/bindings.lisp to pass a pathname. 

-- 
Luis Oliveira
luismbo (@) gmail (.) com
Equipa Portuguesa do Translation Project
http://www.iro.umontreal.ca/translation/registry.cgi?team=pt




More information about the cffi-devel mailing list