larcenists / larceny

Larceny Scheme implementation
Other
202 stars 32 forks source link

Red Edition libraries export too many identifiers #802

Closed WillClinger closed 7 years ago

WillClinger commented 7 years ago

In his official Red Edition announcement, John Cowan wrote

Finally, and as a matter of form, I propose that the libraries above in their (scheme *) form should exclude any identifiers also present in any R7RS-small library. Thus for example (scheme list) will not export the primitive car function, which is in (scheme base), but also will not export the cadr function, which is in (scheme cxr). This is already arranged for in all Schemes, as far as I know, that implement SRFI 1.

John was wrong about precedent, as Larceny has been exporting those identifiers for years and continued to export them when R7RS support was added in v0.98. In my opinion, only a broken implementation of SRFI 1 (or other SRFIs) would fail to export identifiers defined by the SRFI.

In his announcement, John expressed concern about the car procedure exported by (srfi 1) conflicting with the car procedure exported by (scheme base). As John noted, however, "it has been arranged that the definitions of identifiers also present in R7RS-small are identical with those present in the SRFI." That means there are no such conflicts in Larceny's implementation of the Red Edition libraries.

Dismissing John's unfounded concern, there are still two potential problems here:

  1. If (scheme list) exports cadr, then programmers who import (scheme list) but expect to define an unrelated cadr will be upset.
  2. If (scheme list) does not export cadr, then programmers who expect (scheme list) to behave the same as (srfi 1) will be upset.

There shouldn't be any users of Larceny in either of those situations because there has been no public release of Larceny that defines those libraries.

I think the right thing to do is for (srfi 1) to continue to export car and cadr but for (scheme list) not to export them. Larceny's user manual will have to describe this important difference between the Red Edition libraries and the corresponding SRFIs.

WillClinger commented 7 years ago

Accomplished by changeset f222c32111830ad6f6c209a00df08af1cfa56a3a

The only Red Edition library that was affected by this is (scheme list). (srfi 1) continues to export several identifiers that are exported by (scheme base) or (scheme cxr).

WillClinger commented 7 years ago

John Cowan and Alex Shinn say they now think (scheme list) should export exactly the same identifiers as (srfi 1), with no conflicts between those identifiers and the identifiers exported by R7RS-small libraries.

Changeset e742b7c19f5699e70db42011684b63e332257b2a reverted to that more blissful state.