1 Feb 2006 12:03
Re: Re: unnamed callback (closures?)
Jan Rychter <jan <at> rychter.com>
2006-02-01 11:03:10 GMT
2006-02-01 11:03:10 GMT
> >>>>> On Wed, 01 Feb 2006 09:46:27 +0100, Jan Rychter <jan <at> rychter.com> said: > >>>>> "Luís" == Luís Oliveira <luismbo <at> gmail.com>: > > Luís> "Hoehle, Joerg-Cyril" <Joerg-Cyril.Hoehle <at> t-systems.com> writes: > > >> In CLISP, every closure can be turned into a callback, and this is > > >> valuable since it allows to retrieve context information out of the > > >> closure. Is cffi's limitation caused by some implementations? > > > > Luís> To my knowledge, yes. AFAICT, only SBCL/x86 and CLISP support > > Luís> that. > > > > Luís> Regarding the behaviour of CFFI:DEFCALLBACK as a non-toplevel > > Luís> form, not only will it set it globally, the callback itself won't > > Luís> be generated at runtime on most Lisp, IIRC. > > > > I've just ran into the same problem. I really really need closures as > > callbacks. I've tried the naive approach: > > > > (defmacro object-event-callback-add (obj type function) > > `(foreign-funcall "evas_object_event_callback_add" > > :pointer ,obj > > callback-type ,(foreign-enum-value 'callback-type type) > > :pointer (get-callback (defcallback ,(gensym "CB") > > :void > > ((data :pointer) (cb-e evas) (cb-obj object) (cb-event :pointer)) > > (funcall ,function cb-e cb-obj cb-event))) > > :pointer (null-pointer))) > > > > ... but that's a half-baked solution with too many limitations and only > > works in a simple example that you run once. > >(Continue reading)
Beside that, cffi-features:no-lambda-callback might be an independent API to add (together with a means
RSS Feed