[cffi-devel] Messing with foreign types some more

Luís Oliveira luismbo at gmail.com
Fri Feb 23 01:32:11 UTC 2007


[hmm, it seems my previous message didn't go to the list by mistake]

On 22/02/07, Luís Oliveira <luismbo at gmail.com> wrote:
> There's no rush. We should get this right. I put my changes here:
> <http://common-lisp.net/~loliveira/darcs/cffi-newtypes/>. It includes
> some updated documentation.

Here are some random thoughts after a few days of using this.

- There's no direct way of doing inheritance with enum, bitfield,
union or struct types. One can use composition, of course, so it's not
too terrible.

- No inheritance for define-parse-method either. One way to minimize
the effects of this would be to make the :simple-parser option smarter
that would, for instance, look at the class' initargs and
automatically add those to the parser's lambda list as keyword
arguments.

- I'm not sure I like the name :simple-parser. Maybe :default-parser.

- The common case of defining new types with translations but no
arguments got slightly more verbose. Not sure if it's worth worrying
about this.

- I suppose we should export foreign-string-type,
foreign-boolean-type, foreign-pointer-type, etc, so the users can
extend these.

- That reminds that :actual-type might be misleading coming from the
previous system. Specifying :actual-type :string won't inherit any of
foreign-string-type's translators, for instance.

-- 
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/



More information about the cffi-devel mailing list