10 Foundations Guiding Principles
Marc Nieper-Wißkirchen edited this page 2022-04-10 16:42:03 +02:00

Foundations Guiding Principles

This page describes the guiding principles that underlie the effort to standardize a new version of the Scheme programming language. This version will henceforth be called the Foundations. The Foundations are neither the R⁷RS small language, nor the R⁷RS large language. The Foundations extend both the R⁷RS small language and the R⁶RS language and will be rich enough so that the R⁷RS large language can be a implemented as a set of of portable libraries for the Foundations.

  1. The Foundations will a superset of the small language.

    The purpose of the Foundations is not to build yet another version of the Scheme programming language that is incompatible with existing Scheme standards.

    It is part of the charter for the R⁷RS large language to be compatible with the small language. This goal is achieved when building on foundations that extend the small language. The Foundations add missing features to R⁷RS needed to build the large language.

  2. Compatibility to the small language will be maintained except for formal inclusion of errata of the small language into the Foundations and minimal amendments necessary to support all the syntactic abstraction and other features of the Foundations language that weren't foreseeable when the small language was finalized.

    The Foundations undertaking is a perfect opportunity to correct obvious errors in the small language and to incorporate existing errata into a formal specification document. Features of the small language previously specified in overly vague ways are decided on in the Foundations.

    The semantics of program and library bodies of R⁷RS small programs has to be interpreted in a way consistent with the clearer specification of R⁶RS. The alternative interpretation making the excution of programs equivalent to entering their definitions and expressions at the REPL is incompatible with many syntactic extensions that are part of the Foundations.

  3. If an aspect of the small language turns out to be broken, the Foundations will include an option to amend this aspect.

    During the development of the Foundations, the committee may stumble upon features of the small language that are deemed broken but not an obvious error (suitable for being corrected in the errata) nor incompatible with other features to be included in the Foundations. In this case, the broken feature can be deprecated as part of the Foundations and implementations should provide a mode that excludes the deprecated features.

  4. The Foundations will allow to mix R⁶RS programs and libraries with programs and libraries of the small language. This includes the ability to run R⁶RS programs semantically correct.

    A Foundations program can import libraries written in the R⁶RS dialect and libraries written in the small language at the same time. When restricting to the R⁶RS subset, when running in the strict safe mode, an implementation of the Foundations will be a faithful R⁶RS implementation.

    The Foundations include a specification about interoperability of libraries written in the R⁶RS dialect and libraries written in the small language.

  5. The Foundations will include a subset in the spirit of R⁶RS intended to make superseding of R⁶RS possible.

    The Foundations will provide libraries in the namespace (rnrs (7)) intended to supersede the R⁶RS libraries and to make a smooth transition from R⁶RS to the Foundations possible. These libraries will be a moderate advancement of the (rnrs (6)) libraries, including the new features of the Foundations in the spirit of R⁶RS.

  6. The Foundations won't be a minimal language to be compatible with both R⁶RS and R⁷RS.

    Scheme has never been a minimal language. A minimal language wouldn't include let, for example, when it can be expressed in terms of lambda. The Foundations violate minimality even more than that as its libraries both export bindings deriving from R⁶RS and from the small language. For example, the R⁶RS procedure error is strictly more powerful than the procedure error from the small language but both versions are included.

    Thanks to the library system, this does not pose any problem.

  7. The Foundations will require additions to existing Scheme implementations to support them. The necessary additions include all procedures and syntax required to implement the libraries of the large language portably and that can not be implemented portably in the small language.

    The small language was designed to be easily adoptable by existing R⁵RS implementation, which limited the number of features possible in the small language and often forced semantics to be rather loose.

  8. The Foundations will be a self-contained language.

    The Foundations without any extensions are already a practical programming language whose size is comparable to Chez Scheme, for example. The Foundations' size extends slightly that of R⁶RS, e.g. by adding threading, syntactic extensions, and delimited continuations.

    Implementations implementing the Foundations will provide a complete Scheme system. The libraries of the large language will have portable implementations so that users can run programs written for the large language on a Foundations implementation while the implementer of the Foundations implementation won't have to maintain the many standard libraries of the large language.

    The semantics of the Foundations won't be changed or made more strict by the rest of the R⁷RS large project.

  9. The Foundations will be built to serve future versions of the Scheme programming language succeeding both R⁶RS and R⁷RS.

    The Foundations are designed so that it is a viable option to use them as the basis for future standards extending them.

  10. Some subsets of the Foundations may be made optional for an implementation but only in a self-consistent way and so that interoperability with libraries using more than the subset is still maintained.

    Not every Scheme system may support multiple threads running in parallel, for example. If the Foundations include threads, fair scheduling of them can be made optional to allow them to be implemented on single-threaded systems. The libraries will still have to be shipped by the single-threaded implementation to enable the programmer to write libraries that will also work reliably on multi-threaded systems (e.g. by guarding certain code blocks with mutexes).

  11. A strict safe mode in spirit of R⁶RS will be defined but optional for an implementation.

    In contrast to the small language, the language defined by R⁶RS is safe in the sense that "the execution of a safe top-level program cannot go so badly wrong as to crash or to continue to execute while behaving in ways that are inconsistent with the semantics described in the R⁶RS document, unless an exception is raised". Moreover, most violations of the R⁶RS have to be signalled by raising an appropriate violation. While this has clear advantages for writing portable programs and for debugging, in reality some implementations of R⁶RS chose to ignore these requirements. The Foundations deal with this discrepancy by specifying two modes, in which an implementation can operate, a safe mode and an optimizing mode. Every implementation is required to implement at least one mode, and an implementation of the safe mode is also an implementation of the optimizing mode. In the optimizing mode, whenever a violation would be raised accoring to the specification, it is an error in the sense of the small language instead.

    The Foundations may also define the semantics of a debugging mode.

  12. Existence of the Foundations shall not split the Scheme community further but pave a way for unified language standards.

    The Foundations are not only compatible with both R⁶RS and the small language and ensure interoperability between libraries written in both dialects, but also allow writing programs both in the style of R⁶RS and of the R⁷RS small language.

    The large language is a strict extension of the Foundations.

  13. The Foundations will include features that haven't appeared in a Scheme standard yet.

    The language must move forward.

    Such features include identifier properties and identifier aliases. Further planned features are delimited continuations, threads, atomics, a simple FFI, meta definitions, first-class modules.