3 ms·
In theory, R7RS Large will fix the discoverability problem by picking a single blessed SRFI implementation of each kind of library, and giving each one a name l
by ar-nelson 6y ago
In theory, R7RS Large will fix the discoverability problem by picking a single blessed SRFI implementation of each kind of library, and giving each one a name like (scheme hash-table), etc. Whenever it's done. And who knows when that will be.
In the meantime, I'm in the process of building my own "alternate prelude" for several R7RS Schemes that chooses the latest SRFI for most of the common features you'd want (strings, hash tables, console text formatting, etc.) and polyfills them for Schemes that don't have them: https://github.com/ar-nelson/schemepunk https://github.com/ar-nelson/schemepunk
Also, the compatibility story in R7RS is better than you'd think. The biggest problem is that a lot of R7RS implementations are incomplete and don't conform to the standard. For the ones that do, it feels similar to JavaScript in the early 2000s: lots of little inconsistencies, but they can be polyfilled over with enough work. Someone just needs to give it the Crockford treatment and isolate the "good parts" that can be shared between implementations.
- hajile 6y agoThey've been working on r7rs-large for at least 7 years and last I looked had less than 20 SRFI approved. I know they do it on their free time, so no gripes about them. The point is that at the current rate, I'll be retiring before they finish. r7rs-large also doesn't fix issues where some SRFI must be in the r7rs-small spec to ensure cross-implementation compatibility. They need a r7rs-standard which adds these features over the minimalist r7rs-small while retaining r7rs-large as additional libraries.
- slaymaker1907 6y agoI think in general R7RS-large is supposed to be what mainline implementations implement with R7RS-small mainly being for implementations used for embedding scheme as part of a larger application (and even then you might still use large) as well as for experimental/hobbyist implementations. Particularly if you are just using scheme as a scripting language which mostly calls out to C, it doesn't necessarily make a bunch of sense to include complex features like reflection or weak boxes. Such an implementation might not even have a GC in the first place and just rely on the scheme process ending to release memory back to the OS.
- anentropic 6y agoI also feel like it would be useful for Schemes to have a common FFI interface. 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 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?
- slaymaker1907 6y agoJust 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.
- anentropic 6y agoPython 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 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.
- thibran 6y ago> In the meantime, I'm in the process of building my own "alternate prelude" I'm thinking more and more about doing the same. But – there is always a but – I also dislike some other things: Fix procedure signatures → Why is there 'remove' and 'delete'? Scheme is not statically typed, but strangely enough, this fact in not exploited often. There should be only one word with the meaning "delete" in the programming language. Fix argument positioning → The order should always be: proc-name, main-object, arguments... Ideally one should be able to guess the name and arguments of a procedure. Fix procedure names → Some procedure names are too long or have strange names. List procedures should have a list- prefix, only Transducers or generic procedures should have no prefix. Also maybe stop supporting a :key argument and design everything to use lenses to target sub-structures. Some handy general purpose procedures are missing here and there, so an improved prelude should come with them, too. I don't want to import multiple string/list/whatever-libraries to handle a task. The nice thing about Scheme is, all of this is doable.