larcenists / larceny

Larceny Scheme implementation
Other
202 stars 32 forks source link

reorganize standard libraries and their directories #812

Open WillClinger opened 7 years ago

WillClinger commented 7 years ago

The lib directory contains several subdirectories that contain R5RS libraries and several others that contain R6RS/R7RS libraries. One directory, lib/R6RS, contains a mix of R5RS code and R6RS/R7RS libraries.

All of those directories lie within the usual (current-require-path), so all are searched when (larceny:compile-r7rs-runtime) is called during the build process.

That's unnecessarily fragile. Adding a broken library to an unrelated directory shouldn't break the build process.

I would also like to have separate directories for source-only and deprecated R7RS/R6RS libraries that would be available for auto-import but not compiled at build time.

At a more fundamental level, the entire R7RS/R6RS library hierarchy should be reorganized. The R7RS libraries are layered on top of a somewhat confusing mix of R6RS, SRFI, and Larceny-specific libraries. This makes the compiled forms of R7RS libraries larger than necessary, degrading R7RS startup times.

The R5RS versions of SRFI libraries should go into a separate directory. The R7RS Red Edition libraries that are identical or nearly identical to SRFI libraries should probably become primary, with the corresponding SRFI libraries importing from the (scheme *) hierarchy instead of the other way around.

R5RS code will continue to be supported by Larceny's R5RS mode, but Larceny's R5RS layer is also the foundation for R6RS and R7RS layers. Non-R5RS procedures that do not contribute toward support of the R6RS and R7RS layers should be moved into R5RS libraries that are not part of the standard heap images but are loaded at startup in R5RS mode. To make that work, we'll need to distinguish Larceny's default base mode from its R5RS mode. The command-line options needed for that distinction are already present, with the -r5 mode treated the same as the default mode; that can change.

Important organizing principle to keep in mind: