
Sven Panne
Something completely different, but still X11-related: With the current state of the FFI, I can't see an advantage in using GreenCard for the X11 binding. All X11 constants are hardwired through the protocol, and the FFI + its related libraries handle newtypes, (un-)marshaling, error handling, etc. at least as nicely as GreenCard. But on the other hand we already have the GC stuff for X11, but this looks like the only advantage...
The fact that no-one has done the conversion is certainly the most obvious advantage. I also think that GreenCard offers some things that the ffi + libraries does not or does not do as nicely. Describing constants is more verbose (and there's a lot of constants in X) and you usually have to write a separate wrapper function to marshall arguments and results, to catch error conditions and to return multiple values. hsc2hs and c2hs go some way to alleviating these problems and I'd look seriously at them if starting over again. The same applies to Win32 as well except that many functions return error codes so you need wrapper functions in virtually every case. (X11 functions rarely return error codes because it is has an asynchronous connection with the server.) All that said, if anyone wants to have a shot at translating the lot into readable, maintainable pure ffi then please go ahead. (The 'readable, maintainable' part is intended to exclude committing the code generated by greencard :-) -- Alastair