Files
rose-ash/lib/ocaml
giles 82ffc695a5
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 46s
ocaml: phase 4 top-level 'let f (a, b) = body' tuple-param decl (+3 tests, 559 total)
parse-decl-let lives in the outer ocaml-parse-program scope and does
not have access to parse-pattern (which is local to ocaml-parse).
Source-slicing approach instead:

  1. detect '(IDENT, ...)' in collect-params
  2. scan tokens to the matching ')' (tracking nested parens)
  3. slice the pattern source string from src
  4. push (synth_name, pat_src) onto tuple-srcs

Then after collecting params, the rhs source string gets wrapped with
'match SN with PAT_SRC -> (RHS_SRC)' for each tuple-param,
innermost-first, and the final string is fed through ocaml-parse.

End result is the same AST shape as the iteration-102 inner-let
case: a function whose body destructures a synthetic name.

  let f (a, b) = a + b ;; f (3, 7)            = 10
  let g x (a, b) = x + a + b ;; g 1 (2, 3)    = 6
  let h (a, b) (c, d) = a * b + c * d
  ;; h (1, 2) (3, 4)                          = 14
2026-05-09 04:51:11 +00:00
..