[plt-scheme] Eli Barzilay's new FFI stuff

From: Christopher Armstrong (radeex at gmail.com)
Date: Fri Aug 6 22:12:43 EDT 2004

On Fri, 6 Aug 2004 09:02:41 -0400, Eli Barzilay <eli at barzilay.org> wrote:
> But there are probably lots of little tweaks and
> changes that will come when more people use it, so feedback is very
> helpful at this stage.  Mail me or the list if you have any questions,
> suggestions, etc.  

I've been having great success with your FFI so far, it's very nice!
:-) However, I need support for inheritance in define-cstruct.  Should
I 1) try to add it to your define-cstruct macro and send you a patch*
or 2) create my own define-subbable-cstruct macro that simply calls
define-cstruct?

* this will be hard, as your define-cstruct is huge and I am not very
good with define-syntax and syntax-case :)

The advice I got from fellow Schemers was that a good way to do the
interface would be to make either define-cstruct or
define-subbable-cstruct produce define-<name>-substruct that works
like this:

(define-cstruct _structname
  ([x _typ]))

(define-structname-substruct _substructname
  ([y _typ]))

which would expand to

(define-cstruct _substructname
  ([x _typ]
   [y _typ]))

Do you agree that this is a good way to do it?

Also, not that I'm familiar with what's considered sensible in the
Scheme community, but I found it confusing that (define-cstruct _name
([x _typ])) produces name-x as a member getter instead of _name-x....
But that's not a big problem, of course.

-- 
 Twisted | Christopher Armstrong: International Man of Twistery
  Radix  |          Release Manager,  Twisted Project
---------+            http://radix.twistedmatrix.com


Posted on the users mailing list.