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@gmail.com wrote:
Hi,
Two suggestions:
- Could we have a plural form of WITH-FOREIGN-POINTER (similarly to
WITH-FOREIGN-OBJECTS, WITH-FOREIGN-STRINGS).
- 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) ,@body)) `(progn ,@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@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel