Replace core dependency with base + stdio - #1642
Closed
hhugo wants to merge 1 commit into
Closed
Conversation
Core was only used for its container/comparator layer and a handful of
convenience modules, all of which exist in the much lighter base (plus
stdio for I/O). This drops the compiler's dependency footprint
considerably, notably for the js_of_ocaml build.
- Depend on base, stdio, and sexplib0 instead of core; replace the
ppx_jane bundle with the individual rewriters actually used
(ppx_base, ppx_pipebang, ppx_sexp_message, ppx_sexp_value,
ppx_expect, ppx_inline_test). ppx_pipebang is load-bearing: the code
relies on `x |> Constructor` and on pipe-inlined type disambiguation.
- open Base instead of Core; route I/O through Stdio and qualify
stdlib modules Base deprecates (Format, Obj, Scanf, Marshal, ...).
- Replace Core-only APIs: String.{Map,Set,Table,Hash_set} by Base's
comparator-passing style, Comparable.S submodules on Expr.Typed by
explicit Set/Map submodules, Map.Make_using_comparator,
Set.of_map_keys and fst3 by Base equivalents.
- Add Common.Poly_containers providing sexp_of_t for Set.Poly and
Map.Poly in Core's exact output format, so no expect test changes.
- Emit Base.Hashtbl instead of Core.String.Table in the generated
Generated_signatures module.
No behavioral changes: all unit, integration, and stancjs tests pass
unchanged.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes the dependency on Jane Street's
core, replacing it with the much lighterbase+stdio(+sexplib0). This shrinks the dependency footprint and build time, which is particularly relevant for the js_of_ocaml (stancjs) build.core→base,stdio,sexplib0. Theppx_janebundle is replaced with only the rewriters actually used:ppx_base,ppx_pipebang,ppx_sexp_message,ppx_sexp_value,ppx_expect,ppx_inline_test.open Baseinstead ofopen Core; I/O goes throughStdio; stdlib modules that Base deprecates (Format,Obj,Scanf,Marshal, …) are qualified withStdlib.String.{Map,Set,Table,Hash_set}→ Base's comparator-passing style (Map.M(String).t,Set.of_list (module String),Hashtbl.create (module String), …)Expr.Typed'sMap/Setsubmodules (previously fromCore.Comparable.S, which Base does not provide) are now small explicit submodules exposing exactly the operations used.Map.Make_using_comparator,Set.of_map_keys,fst3→ Base equivalents.Common.Poly_containers: Base'sSet.Poly/Map.Polylack sexp converters, so this providessexp_of_tfor both in Core's exact output format — which is why no expect-test output changed.Generated_signaturescode generator now emitsBase.Hashtblinstead ofCore.String.Table.Notes for reviewers
ppx_janesilently included ppx_pipebang (rewritesx |> ftof xat parse time), and the codebase depends on it: e.g.|> UnsizedType.UArray(constructor after pipe) and several places where record/constructor disambiguation only typechecks with the pipe inlined. It is kept as an explicit dependency.elt ** 2.→elt *. elt(Base makes**integer exponentiation) andOperator.of_string_optbuilds itsSexp.Atomdirectly instead of going through the deprecatedSexp.of_string.Testing
dune build @allcleandune runtest(unit expect tests + integration cram suite): all pass without a single expected-output changedune build @runjstest(stancjs under node): passesstancbinary end-to-end on an integration model🤖 Generated with Claude Code