Skip to content

Defunctionalize the dune sexp decoder - #12768

Merged
rgrinberg merged 2 commits into
ocaml:mainfrom
rgrinberg:defunctionalize-dune-sexp
Dec 5, 2025
Merged

rgrinberg merged 2 commits into
ocaml:mainfrom
rgrinberg:defunctionalize-dune-sexp

Conversation

@rgrinberg

Copy link
Copy Markdown
Member

Defunctionalize the CPS based implementation into constructors that can be optimized. This is an almost mechanical transformation to allow:

  1. The removal of some useless closures
  2. A proper implementation of either that doesn't mindlessly backtrack
  3. Much later, a removal of the >>= to allow to retarget the decoder in the command line.

There's other benefits as well, but this is enough for now.

@rgrinberg
rgrinberg force-pushed the defunctionalize-dune-sexp branch 8 times, most recently from 5abc53b to 8b726cb Compare December 5, 2025 22:52
Signed-off-by: Rudi Grinberg <[email protected]>
Necessary to implement either in a non hacky way (amongst other things)

Signed-off-by: Rudi Grinberg <[email protected]>
@rgrinberg
rgrinberg force-pushed the defunctionalize-dune-sexp branch from 8b726cb to ff1b041 Compare December 5, 2025 23:54
@rgrinberg
rgrinberg merged commit 550dd97 into ocaml:main Dec 5, 2025
davesnx added a commit to davesnx/dune that referenced this pull request Dec 8, 2025
…without-system

* 'main' of github.com:/ocaml/dune: (30 commits)
  Add (files) stanza (ocaml#12879)
  Make sure to use string equality in parsing hot path (ocaml#12874)
  Hoist up [Dune_sexp.Decoder.sum] uses (ocaml#12876)
  Delay ocaml-index dependencies (ocaml#12881)
  Simplify Lib.requires (ocaml#12880)
  Lib: delay applying modules (ocaml#12884)
  Annotate some ignored parameters in lib.ml (ocaml#12883)
  feat: expand variables in `(promote (into ..))` (ocaml#12832)
  dune-binaries.t: nix ci (ocaml#12875)
  fix: greedy version location in lang declarations (ocaml#12869)
  Reproduction case for ocaml#6220. (ocaml#6221)
  Defunctionalize the dune sexp decoder (ocaml#12768)
  disable flake (ocaml#12873)
  refactor: [instantiate] takes a regular library (ocaml#12849)
  Respect potentially existing lock dir when running format rules (ocaml#12847)
  fix: ascii start
  chore: updated CR someday
  chore: added entry for CHANGES.md
  fix: else claude message
  tests: promoted non-ascii-characters.t to new logic
  ...
@Alizter Alizter added this to the 3.21.0 milestone Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants