[cffi-devel] Re: Macro-ifying a Python callback

Luís Oliveira luismbo at gmail.com
Thu Feb 9 00:26:17 UTC 2006


Jeremy Smith <jeremy at decompiler.org> writes:
> I have 2 questions, one specific to Python.
>
> *How do I create a callback with a gynsym'd symbol, which actually refers to 
> a lambda expression and not a defun'd function? The %callback thing seems 
> hard-wired to specifically naming it with a symbol, and creating a global 
> scope for it, which is okay as long as I can create non-clashing
> lambda's.

I'm not sure what you want here. You can write a macro that expands into
a defcallback with a name created by gensym.

  (defmacro foo (....)
    `(defcallback ,(gensym) (...)
       ...))

What exactly do you want to do?


> *The Python specific one is: Given a function which takes the following 
> definition:

Did you forget to actually ask the question? I couldn't understand what
the question was.

-- 
Luís 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