That said, I think that in Scheme, standard is quite different from portable – 
if something standard is implemented, it will be (mostly) according
to the standard, so in this way it is ‘portable’, but that’s a big ‘if’. For 
large Schemes (and small Schemes for which the RnRS or SRFI stuff is
implemented in a separate library that can easily be installed(*)), I don’t 
expect much trouble, but for very minimalistic (or outdated Schemes,
but that holds for other languages as well) you might possibly be in trouble.

Indeed, Scheme doesn't have a clear separation between full-featured RnRS implementations and subset implementation. Several people have noted that this is confusing.

There are subsets of e.g. C, ML, Haskell, and Perl, but these are clearly indicated s such.

Is (import (srfi :N)) portable in practice?

AFAIK:

(import (srfi :N)) is portable across all R6RS implementations.

(import (srfi N)) - without the colon - is portable across all R7RS implementations.

Mnemonic SRFI imports - e.g. (srfi 1 lists) - are currently not available in any R7RS implementation.

In R6RS land, at least some implementations support mnemonic SRFI imports using the form (srfi :1 lists). I'm not sure how many. There are discrepancies in the names (e.g. "lists") among some R6RS implementations.

It's really a mess that should be cleaned up. Any technical problems have been overcome - it's entirely a social issue. It should be pursued on the srfi-discuss mailing list.

I switched from (use-modules ...) to (import ...) to get towards making
my code easier to re-use on different Schemes, but I didn’t actually try
using it on another Scheme implementation.

Thank you for making the effort.

The current crop of portable code has been written by very few schemers. With a few extra people we will rapidly get more impressive results. In my experience, the foundation provided by R6RS and R7RS is excellent and the few known practical problems can be solved.

https://github.com/arcfide/chez-srfi is a notable project in R6RS portability. Despite its name, it is not limited to Chez Scheme.

R7RS has an (include "...") mechanism which R6RS lacks. chez-srfi adds a similar mechanism on top of the R6RS library system. The chez-srfi mechanism is widely portable in practice.

Reply via email to