[cffi-devel] %expand-type-to-foreign-dyn vs *runtime-translator-form*

Stephen Compall s11 at member.fsf.org
Wed Mar 1 19:53:41 UTC 2006


On Tue, 2006-02-28 at 23:58 -0600, Stephen Compall wrote:
> If a translation method is available [for some defn thereof], as found
> by compute-applicable-methods, but that method answered
> *runtime-translator-form*, the final result of the expander would be
> something like
> 
> `(multiple-value-bind (,var ,param)
>      (translate-type-to-foreign ,value ,type)
>    (unwind-protect
>        (progn , at body)
>      (free-type-translated-object ,var ,type ,param)))
> 
> Otherwise, both implementations of expand-type-to-foreign-dyn would
> short-circuit the generic function call and return
> 
> `(let ((,var ,(expand-type-to-foreign value type)))
>    , at body)

I fixed the macroexpansion at http://paste.lisp.org/display/17379 and
added a couple tests demonstrating this behavior to misc-types.lisp in
http://scompall.nocandysw.com/cffi/foreign-dyn-behavior-tests.darcs.patch

Wed Mar  1 13:41:22 CST 2006  Stephen Compall <scompall at nocandysw.com>
  * demonstrate differing behavior between foreign-dyn expansions

  - change expand-type-to-foreign-dyn for foreign-typedef to not
    short-circuit expand-type-to-foreign when falling back (see paste
    17379)
  - add tests showing that you can change the foreign-dyn expansion
    semantics by providing an expand-to-foreign method that falls back

-- 
Stephen Compall
http://scompall.nocandysw.com/blog




More information about the cffi-devel mailing list