[cffi-devel] plural forms for WITH-FOREIGN-POINTER and in general
Tamas K Papp
tkpapp at gmail.com
Thu Dec 10 07:35:27 UTC 2009
OK, consider the code to be in the public domain.
define-with-multiple-bindings or something similar would probably be a
better name.
Tamas
On Wed, 09 Dec 2009 19:16:50 -0500, Liam Healy wrote:
> I like the idea of 2; it seems general enough that it belongs in
> alexandria.
>
> Liam
>
> On Wed, Dec 9, 2009 at 9:10 AM, Tamas K Papp <tkpapp at gmail.com> wrote:
>> Hi,
>>
>> Two suggestions:
>>
>> 1. Could we have a plural form of WITH-FOREIGN-POINTER (similarly to
>> WITH-FOREIGN-OBJECTS, WITH-FOREIGN-STRINGS).
>>
>> 2. In my own code, I usually use something like this:
>>
>> (defmacro with-multiple-bindings (macro)
>> "Define a version of `macro' with multiple arguments, given as a
>> list. Application of `macro' will be nested. The new name is the
>> plural of the old one (generated using format)."
>> (let ((plural (intern (format nil "~aS" macro))))
>> `(defmacro ,plural (bindings &body body)
>> ,(format nil "Multiple binding version of ~(~a~)." macro) (if
>> bindings
>> `(,',macro ,(car bindings)
>> (,',plural ,(cdr bindings)
>> , at body))
>> `(progn , at body)))))
>>
>> (with-multiple-bindings with-foreign-pointer)
>>
>> Incorporating something similar would replace the repetitions in the
>> CFFI code, and make it easier to define plural forms.
>>
>> Cheers,
>>
>> Tamas
>>
>>
>> _______________________________________________ cffi-devel mailing list
>> cffi-devel at common-lisp.net
>> http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel
>>
More information about the cffi-devel
mailing list