Cleaning up racket/private dependencies - #15
Conversation
Previously, it was a conglomeration of explicit IDs, various `all-from`s from various `racket` (sometimes private) racket modules, and some `all-from-except`s. This was far from ideal. It prevents those modules from adding or removing provided identifiers without a synchronized change in `mzscheme`, which lives in a different repo. In contrast, the list of identifiers provided by `mzscheme` will probably rarely, if ever, change; the whole point is to preserve compatibility with existing code. Listing the provides explicitly is ugly, but much less error-prone. Test: Print the module's provided identifiers along with the source bindings using https://gist.github.com/jesboat/6c474b9fc78b59ec2a6b6c8b975def80 It's the same before and after.
Previously, it was a conglomeration of various `racket/*` modules, some nominally private, many used in the construction of racket/base. This is undesirable for reasons described in the previous commit. Instead, we can replace it almost entirely with public exports from `racket/base`, `racket/tcp`, `racket/udp`, and `racket/promise`. Only 6 imports cannot be replaced with public exports; they're handled in the next commit. Test Plan: Print the module's provided identifiers along with the source bindings using https://gist.github.com/jesboat/6c474b9fc78b59ec2a6b6c8b975def80 It's the same before and after.
In `mzscheme/priavte/*.rkt`, there are some uses of some of various standard Scheme-ey macros. Previously, those were being imported directly from various `racket/private/*` modules which were chunks of racket/base. Import them from `racket/base` instead. Test: Change was done interactively. The count of bound uses DrRacket shows for each of the required modules adds up properly. Checking that the required identifiers are compatible is manual.
In mzscheme/main.rkt, use the `for-compatability-lib` module created in racket/racket#5425 Test: Print the module's provided identifiers along with the source bindings using https://gist.github.com/jesboat/6c474b9fc78b59ec2a6b6c8b975def80 It's the same before and after.
Previously, the module defined two structs: 1. Struct `struct:break-paramz` (defined with `make-struct-type` and, confusingly, with reflexive name `break-parameterization`) used for the break parameterization 2. Struct `break-parameterization` (defined with the only remaining use of `-define-struct`) which is unused locally and not `provide`d anywhere. This goes at least as far back as v3.99.0.2, git 39cedb6, svn r7706. Remove the unused one, which will enable removing `-define-struct` once racket/compatibility#15 is also merged
|
Reducing the use of private modules is a great improvement! I'm less sure of the value of listing all exports explicitly, as far as i understand things now. At a minimum, it seems like the documentation would need a corresponding change, since it currently says " |
Previously, the module defined two structs: 1. Struct `struct:break-paramz` (defined with `make-struct-type` and, confusingly, with reflexive name `break-parameterization`) used for the break parameterization 2. Struct `break-parameterization` (defined with the only remaining use of `-define-struct`) which is unused locally and not `provide`d anywhere. This goes at least as far back as v3.99.0.2, git 39cedb6, svn r7706. Remove the unused one, which will enable removing `-define-struct` once racket/compatibility#15 is also merged
|
Hmm. We've got https://docs.racket-lang.org/mzscheme/index.html starting with "The mzscheme language provides nearly the same bindings as the mzscheme module of PLT Scheme version 372 and earlier.", but an implementation and docs which seem to define themselves by the difference between them and racket/base. I feel like there's an inherent tension there, with whether mzscheme is closer to "like PLT Scheme 372" or "scheme/base but with X changed". I don't think it makes sense to have an implicit export list without an the imports also being implicit; for racket/base, that might be a bit obnoxious, but I can try prototyping it. I can think of a couple other options:
Thoughts? |
|
I see. I was going more by "Omitted Forms and Functions", which I took to imply that everything else not replaced was included, but maybe that's not really what it says. The combination of 2 and 3 (1 seems like overkill) sounds ok to me. |
Perhaps it was originally intended to mean that, but, as time has passed and
Ack. |
|
Here's the delta between 372 (the binary build still runs fine!) and the current |
So, doing 2 is also turning out to be messier than anticipated, because mzscheme's been exporting most of #%kernel for a while, and there's a pile of stuff in #%kernel whose public documentation (and therefore where the mzscheme's scribblings would want to link) is spread out. There's the expected stuff in racket/{base,tcp,udp,promise}, but there's also:
I'm tempted to suggest: (a) Merge racket/racket#5425 to main repo. |
In the preceding commits (racket#15), I consistently spelled "compatibility" wrong. Fix it. Fixing the filename requires a cross-repo change (with this and racket/racket#5434), so it'll be the second cross-repo breaking change in ~3 hours, but it seems better to do it now than wait until later or leave the misspelling there forever. Sorry :(
In the preceding commits (#15), I consistently spelled "compatibility" wrong. Fix it. Fixing the filename requires a cross-repo change (with this and racket/racket#5434), so it'll be the second cross-repo breaking change in ~3 hours, but it seems better to do it now than wait until later or leave the misspelling there forever. Sorry :(
This was previously most recently used to implement a prior version of `syntax-parameterize`, an unused struct which was removed in bf48460, and had an unnecessary reference in compatability-lib (removed in racket/compatibility#15). Now that those are all gone, we can remove it.
This was previously most recently used to implement a prior version of `syntax-parameterize`, an unused struct which was removed in bf48460, and had an unnecessary reference in compatability-lib (removed in racket/compatibility#15). Now that those are all gone, we can remove it.
This PR is part of an effort to clarify what in racket/private is intended to be used (or is used) by other first-party packages. The overall plan is described in racket/racket#5425; this is the changes to compatability-lib.
Note that
compatability-libstill has dependencies onracket/private/*modules-- but none of them are also dependencies of racket/base, and all of them are properly documented in racket/racket#5425.There are four conceptual changes, each of which is in its own commit, but I think it's best to review as a single unified PR. The descriptions and test plan is:
Commits
Use an explicit list of provided identifiers in mzscheme/main.rkt
Previously, it was a conglomeration of explicit IDs, various
all-froms from variousracket(sometimes private) racket modules, and someall-from-excepts. This was far from ideal. It prevents those modules from adding or removing provided identifiers without a synchronized change inmzscheme, which lives in a different repo.In contrast, the list of identifiers provided by
mzschemewill probably rarely, if ever, change; the whole point is to preserve compatibility with existing code. Listing the provides explicitly is ugly, but much less error-prone.Revamp mzscheme/main.rkt require list
Previously, it was a conglomeration of various
racket/*modules, some nominally private, many used in the construction of racket/base. This is undesirable for reasons described in the previous commit. Instead, we can replace it almost entirely with public exports fromracket/base,racket/tcp,racket/udp, andracket/promise. Only 6 imports cannot be replaced with public exports; they're handled in the next commit.Stop using racket/private/* dependencies of racket/base, part 1
In
mzscheme/priavte/*.rkt, there are some uses of some of variousstandard Scheme-ey macros. Previously, those were being imported
directly from various
racket/private/*modules which were chunksof racket/base. Import them from
racket/baseinstead.Stop using racket/private/* dependencies of racket/base, part 2
In mzscheme/main.rkt, use the
for-compatability-libmodule created inracket/racket#5425
Testing
Using
https://gist.github.com/jesboat/6c474b9fc78b59ec2a6b6c8b975def80
to print the provides of
mzscheme/main.rktalong with their original bindings, and it shows the same before and after. Reviewing the other files is done manually.