1

Is the new Scheme standard, R6RS which was published in 2007, backwards compatible with the older standard R5RS? If not, is there a compatibility mode in R6RS?

4

I'm afraid it's not backward compatible. A R6RS file is expected to start with importing a library. If your files started with:

#!r6rs
(import (rnrs))

Most of R6RS will be available. R5RS won't recognize those two lines so in an R5RS-version you need to skip those two or comment them out. It's possible to do this with standard command line tools so you can write one source file an generate for the other though. You won't be able to use load from R6RS so your code must reside (or end up) in one file.

Some implementations however, e.g. ikarus, allows to run code without the #!r6rs and the initial import form even if it's a R6RS implementation, but the standard requires them in an top level R6RS program.

In appendix E of the R6RS standard you can see what have changed and you should avoid using new features. I.e. you should use the R5RS specification and write lower case since R6RS is case sensitive.

The newer R7RS draft specification is mainly based on R5RS and their import form is the same as R6RS. Their library implementation however, though similar, is incompatible with R6RS since they deliberately used different forms. Anyway, to be compatible with R5RS you cannot create libraries without having to do a lot of processing to create a compatible R5RS-version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.