Re:Cyclone Scheme
by slaymaker1907 on Tuesday October 06, 2020 @04:17PM
(#24701875)
Just look at Python to see how difficult this is. It's hard to specify a FFI which doesn't assume a bunch of things about the implementation of the language. Racket is also having some pain points with this in the move over to the Chez Scheme backend.
Re:Cyclone Scheme
by anentropic on Wednesday October 07, 2020 @05:33AM
(#24706575)
Python is different since most people use the same implementation (I realise the whole FFI situation there is currently undergoing an overhaul to better support PyPy)
And https://github.com/ktakashi/r6rs-pffi seems to show that such a thing is possible for Scheme as it supports half a dozen different R6RS Schemes, but (I believe?) it needs library authors to target the PFFI interface rather than the implementation-specific FFI interface of a particular Scheme as most do currently.
So it seems like that shows that a compatibility layer is possible, at least for many of the major Schemes, and it "just" needs standardisation and adoption.
Currently AFAICT (I don't know much, so might be wrong...) each Scheme implementation has its own FFI. So even though pure-Scheme R6RS or R7RS libraries are portable across multiple Schemes I don't think any Scheme libs which are wrappers for C libs are (?)
But these C libs are often vital to many projects.
I found this attempt at such a thing: https://github.com/ktakashi/r6rs-pffi ("R6RS Portable Foreign Function Interface")
But I didn't find many libs which were written on that PFFI. What I mostly see are libs specific to a single Scheme implementation.
Would love to know if my impression here is correct or if things are actually better than that?