
On Tue, Feb 26, 2013 at 11:29 PM, Ronald Oussoren ronaldoussoren@mac.comwrote:
On 26 Feb, 2013, at 16:13, Maciej Fijalkowski fijall@gmail.com wrote:
Hello.
I would like to discuss on the language summit a potential inclusion of cffi[1] into stdlib.
The API in general looks nice, but I do have some concens w.r.t. including cffi in the stdlib.
- Why is cffi completely separate from ctypes, instead of layered on top
of it? That is, add a utility module to ctypes that can parse C declarations and generate the right ctypes definitions.
- Cffi has a dependencies on pycparser and that module and its
dependencies would therefore also be added to the stdlib (even if they'd be hidden in the cffi package)
- Cffi basicly contains a (limited) C parser, and those are notoriously
hard to get exactly right. Luckily cffi only needs to interpret declarations and not the full language, but even so this can be a risk of subtle bugs.
pycparser has been around for more than 4 years and is pretty stable. I know that it's been used to parse Windows headers, Linux system headers and other "scary" things for a C parser to handle. It's only known problem has to do with over-creative abuses of C's context sensitivity: http://eli.thegreenplace.net/2011/05/02/the-context-sensitivity-of-c%E2%80%9...
In practice it doesn't come up often, and almost never in declarations, which is the subset cffi uses pycparser for.
Eli