On Sun, Aug 17, 2008 at 4:46 PM, Roland Averkamp <[EMAIL PROTECTED]> wrote:

> Is it really necesary to use the Babel and Alexandria libraries in CFFI?
> Now CFFI depends on two libraries and every other system which uses
> CFFI needs these two libraries too.

That's an issue that was taken into consideration.


> Some comments in Babel mention that it is only usefull for a lisp with
> unicode suppport. But for example Allegro and Clisp already have functions for
> character set conversions.

At one point, there was a CFFI branch that implemented foreign
encodings using the functionality provided by each Lisp. But the
encoding support and error semantics vary wildely and that made it a
bit useless. You can find more details about that effort in the
mailing list archives.


> I think it would be better that strings with a non native character set are 
> handled
> like (unsigned-byte 8) or (unsigned-byte 16) arrays which are zero terminated.
> And it is up to the application to convert them, with Babel or some buildin 
> functions.

That would introduce an extra step in the conversion:

    foreign memory -> lisp array -> lisp string

A better solution, perhaps, would be to split string support into a
different system. Is it worth the trouble though?

Out of curiosity, plain-odbc seems to use strings a lot, I would
assume that foreign string encoding support would be useful for your
library. Am I wrong?


> Regarding Alexandria:
> I believe only three macros from Alexandria are used.
>
> Maybe ONCE-ONLY is nice, but not much simpler than (let ((a (gensym "a"))) 
> `(let (,a ...) ... ,a)).
>
> The same holds for WITH-UNIQUE-NAMES.

Version 0.10.0 uses ENSURE-LIST, FEATUREP, FORMAT-SYMBOL, IF-LET,
MAKE-GENSYM-LIST, ONCE-ONLY, PARSE-BODY, SYMBOLICATE, WHEN-LET and
WITH-UNIQUE-NAMES. They are, of course, somewhat simple utilities that
could be copied & pasted into Babel and CFFI.

Is that code duplication better or worse than adding a library
dependency? Perhaps if you use some of Alexandria's utilities in your
own code you'll feel better about it? :-)

-- 
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/
_______________________________________________
cffi-devel mailing list
cffi-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel

Reply via email to