I learned today from the introduction to the Common Lisp CFFI manual that there are two basic kinds of FFIs: those which answer the question "How can we write C code, generally rather weird C code, that interoperates seamlessly with Scheme?", and those which answer the question, "How can we write Scheme code, generally rather strange Scheme code, that interoperates seamlessly with C?"
The withdrawn SRFI 50 was mostly of the first type; CL CFFI is of the second type. In both cases, the usual purpose of the FFI is to glue useful things in C libraries into Scheme so they can be used by Scheme programs. However, in the first case, the glue is written in C; in the second case, in Scheme. The Chicken FFI, which is the one I'm most familiar with, provides both specialized Scheme that talks to C and specialized C that talks to Scheme, but the former is by far the more commonly used. The second is mostly a fallout of the way Chicken translates Scheme to C: some of the special API the compiler uses in compiled code is documented and provided to C programmers. On the whole, I'm inclined to think that it's better to write glue in Scheme than in C, and therefore what should be standardized are procedures and syntax that make C types, variables, and procedures visible to Scheme. I'll read further in the CFFI manual to see what, if anything, can be gleaned from it. It's a rich and complex API. -- But that, he realized, was a foolish John Cowan thought; as no one knew better than he [email protected] that the Wall had no other side. http://www.ccil.org/~cowan --Arthur C. Clarke, "The Wall of Darkness" _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
