Skip to content

with fmt: configurable line width and symmetric single-expression folding (D238) - #3637

Merged
ehartford merged 1 commit into
mainfrom
fmt-width
Nov 26, 2026
Merged

ehartford merged 1 commit into
mainfrom
fmt-width

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Implements #2519 per Eric's ruling (D238 / Law 13; spec v7.95).

  • Configurable width in with fmt: defaults to 100 columns; configurable via --max-width N (and --max-width=N) and [fmt] max_width = N in with.toml, with CLI overriding with.toml (src/compiler/ProjectConfig.with, src/main.with, build/compiler.with).
  • Symmetric folding rule (src/Fmt.with): folds a comment-free block body holding a single plain (single-line, non-block) expression onto the header line when the full rendered line (including leading indentation) is at most the configured width; unfolds an inline single-expression body into a multi-line body when it exceeds the configured width, preserving any trailing comment and staying idempotent.
  • Spec & Law 13 doc revisions: updated docs/spec/029_lexical-and-binding-rules.md (§29.13, verbatim blessed wording), docs/spec/README.md (v7.95), docs/proposals/with-fmt.md (removed the historical style/semantics conflation and unconfigured soft limit to follow Law 13), and docs/meetings/2026-11-25-D235-rulings-on-the-briefs-of-2026-11-25.md (noted D238 / Law 13 amendment).
  • Tests: test/behavior/behav_2519_fmt_width_and_folding.with covering default 100-col boundary (100 folds, 101 unfolds), custom --max-width 60 + with.toml + CLI override, indented method near the boundary, comment-bearing bodies untouched, over-width inline body with trailing comment remaining idempotent, and compiler accepting >100-col lines.

closes #2519

@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on b22210302 (wall=1009s, all 12/12 macOS UAT scenarios green):

out/battery/battery.log: rc=0 green

@ehartford
ehartford marked this pull request as ready for review November 26, 2026 18:49
@ehartford
ehartford merged commit 3a1389f into main Nov 26, 2026
1 check passed
@ehartford
ehartford deleted the fmt-width branch November 26, 2026 18:49
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.

with fmt: configurable line width and symmetric folding of plain single-expression bodies (Law 13)

1 participant