[cffi-devel] Re: unnamed callback (closures?)

Jan Rychter jan at rychter.com
Wed Feb 1 09:44:36 UTC 2006


>>>>> "James" == James Bielman <jamesjb at jamesjb.com> writes:
 James> Jan Rychter <jan at rychter.com> writes:
 >> I mostly develop on SBCL/x86 and ECL, so even if a solution worked
 >> on these platforms only, I'd be really happy.

 James> If all else failed, you could resort to passing something like:

 James> #+sbcl (alien-sap (alien-lambda ...))  +ecl #| whatever is
 James> #appropriate for an ecl anon callback |#

 James> as a pointer to a CFFI function.

Not sure if I fully understand what you mean here, but I'll try reading
some code. Perhaps I can implement something myself.

 James> While I'd like to see some kind of CALLBACK-LAMBDA as the base
 James> primitive in CFFI-SYS for callbacks someday, the implementation
 James> support for this is pretty minimal.

 James> I think it boils down to: how many Lisps need to support
 James> something before we consider adding it an optional feature to
 James> CFFI-SYS?  If there's enough support, what about exporting some
 James> sort of CFFI-FEATURES:NO-ANONYMOUS-CALLBACKS feature and adding
 James> CALLBACK-LAMBDA to CFFI-SYS for the Lisps that can do it?

Well, let me pitch in with a vote: I consider this feature absolutely
essential for any serious GUI programming. Generated menus with closures
that get called back and already have all the context information are
what makes Lisp GUI programming different from C GUI programming. If you
don't put that on top of GTK (or EFL, in my case), you end up with a
Lisp program that reads like C.

So I'd really like to see optional support like what you described
above.

Besides, I believe that if one or two implementations support a feature
like this and it becomes popular, others will follow. Lowest common
denominator isn't always the best way to go.

--J.



More information about the cffi-devel mailing list