| @@ -289,7 +289,7 @@ fn count(xs, acc) |
| 289 | 289 | (it never hugs the opener); a comment anywhere forces the break, as |
| 290 | 290 | ever. |
| 291 | 291 | - `type Color { Red, Green }` joins one line when it fits; broken, it is |
| 292 | | − Revision 3's shape. |
| 292 | + Revision 4's shape. |
| 293 | 293 | |
| 294 | 294 | The repository is reformatted in this revision's diff, with `tests/ui` |
| 295 | 295 | re-blessed and the parser and bindgen snapshots re-taken. |
| @@ -297,7 +297,7 @@ re-blessed and the parser and bindgen snapshots re-taken. |
| 297 | 297 | ## Revision 7 — 2026-10-23: comma-braces under their head; statement braces Rust-style |
| 298 | 298 | **Status:** Accepted (owner); needs engineering review (#44). |
| 299 | 299 | |
| 300 | | −Revision 5 moved every brace under its head; that taxed Rust-shaped code |
| 300 | +Revision 6 moved every brace under its head; that taxed Rust-shaped code |
| 301 | 301 | for uniformity it did not need. The split that reads right: |
| 302 | 302 | |
| 303 | 303 | - **Comma-brace groups** — `match` arms, `with` clauses, a type's |
| @@ -332,17 +332,17 @@ for uniformity it did not need. The split that reads right: |
| 332 | 332 | The repository is reformatted in this revision's diff, with `tests/ui` |
| 333 | 333 | re-blessed. |
| 334 | 334 | |
| 335 | | −## Revision 8 — 2026-10-23: application under the callee, parameters under `::` (ADR 0061) |
| 335 | +## Revision 8 — 2026-10-23: application under the callee, parameters under `::` (ADR 0062) |
| 336 | 336 | |
| 337 | | −**Status:** Accepted (owner); needs engineering review (#44). Numbered 7 |
| 338 | | −because Revisions 4 (sorted imports), 5 (fits-or-breaks-fully) and 6 |
| 339 | | −(comma-braces under their head, statement braces Rust-style) landed on the |
| 340 | | −base branch meanwhile; this revision is the application side of ADR 0061. |
| 337 | +**Status:** Accepted (owner); needs engineering review (#44). Drafted on |
| 338 | +the parens-free branch while Revisions 5 to 7 landed on its base; this |
| 339 | +revision is the application side of ADR 0062 (numbered 0061 on that |
| 340 | +branch). |
| 341 | 341 | |
| 342 | | −With ADR 0061's parens-free calls, Revision 3's call exception retires: |
| 342 | +With ADR 0062's parens-free calls, Revision 4's call exception retires: |
| 343 | 343 | there is no `(` to keep on the callee's line. An application fits on its |
| 344 | 344 | line or its arguments move whole under the callee, one indent in, one per |
| 345 | | −line — the under-form Revision 3 reserved for this change: |
| 345 | +line — the under-form Revision 4 reserved for this change: |
| 346 | 346 | |
| 347 | 347 | ``` |
| 348 | 348 | let req = |
| @@ -365,10 +365,98 @@ let req = |
| 365 | 365 | -> () / <io> |
| 366 | 366 | ``` |
| 367 | 367 | |
| 368 | | −- **Construction keeps Revision 3's rule**: a constructor's field list |
| 368 | +- **Construction keeps Revision 4's rule**: a constructor's field list |
| 369 | 369 | keeps its parentheses, hugs its first field, and leads with commas — |
| 370 | 370 | `User(name: "ada", hash: h)`; `Mismatch\n ( expected\n , found\n )`. |
| 371 | 371 | - **`fn` types print their parameters comma-separated** (`fn(a, ~b: B) -> |
| 372 | 372 | c / <e>`); a label hugs its type. |
| 373 | 373 | - The token check is unchanged in kind: significant tokens and comments |
| 374 | 374 | must be the input's. |
| 375 | + |
| 376 | +## Revision 9 — 2026-10-27: statement braces are Allman; types never hug |
| 377 | +**Status:** Proposed (owner's request); needs engineering review (#44). |
| 378 | + |
| 379 | +Two changes of style, and the printer's internals simplified alongside. |
| 380 | + |
| 381 | +**Statement braces are Allman (C#-style).** The `{` of a function body, of |
| 382 | +an effect's, trait's or impl's members, and of a `defer` goes on its own |
| 383 | +line under the head, the contents one indent in, the `}` under the `{`. |
| 384 | +This supersedes Revision 7's Rust-style statement braces. |
| 385 | + |
| 386 | +``` |
| 387 | +pub fn area :: shape: Shape -> Float |
| 388 | +{ |
| 389 | + if shape.round |
| 390 | + { |
| 391 | + circle shape |
| 392 | + } |
| 393 | + else |
| 394 | + { |
| 395 | + let s = shape.side |
| 396 | + s * s |
| 397 | + } |
| 398 | +} |
| 399 | +``` |
| 400 | + |
| 401 | +- **A statement always breaks**: an `if` chain (every `else` and |
| 402 | + `else if` on its own line), a plain block, a `region` or a `handle` |
| 403 | + standing directly in a block, its value included. Revision 7's "an |
| 404 | + `if` may stay on one line" now holds for values only. |
| 405 | +- **A value stays on one line when it fits**: `let y = if c { a } else |
| 406 | + { b }`, `list.map xs fn x { x * 2 }`, a block as an arm body. When it |
| 407 | + breaks, it goes Allman too, the whole `if` chain at once. A lambda's |
| 408 | + `{` goes under its `fn`, and a block value's goes under the `=` or `->`. |
| 409 | + A lambda argument that does not fit still moves the application's |
| 410 | + arguments under the callee (Revision 8). |
| 411 | +- An interpolation hole stays on one line (Revision 3). An empty `{}` |
| 412 | + stays on its head's line (`fn main :: {}`). |
| 413 | +- Comma-brace groups (match arms, `with` clauses, variants) keep |
| 414 | + Revision 7's shape: `{` under the head, hugging the first entry. |
| 415 | + |
| 416 | +**Types never hug.** A broken type list ends its line at the opener: the |
| 417 | +elements one indent in, the commas and the closer at the line's indent. |
| 418 | +This supersedes Revision 4's "type arguments break in place hugging their |
| 419 | +first element", which left a space after the opener (`Map< Key`): |
| 420 | + |
| 421 | +``` |
| 422 | +fn insert :: |
| 423 | + table: Map< |
| 424 | + String |
| 425 | + , List<Row> |
| 426 | + > |
| 427 | + -> () |
| 428 | +``` |
| 429 | + |
| 430 | +- It covers type arguments and parameters, tuple types, a `fn` type's |
| 431 | + parameters (the `(` stays on the `fn`; the return type goes on its own |
| 432 | + line), effect rows (`-> T / <` stays on its line; the row no longer |
| 433 | + moves under the `/` before breaking) and a constructor's declared fields |
| 434 | + (`Form(` stays on the name). |
| 435 | +- Expression and pattern lists keep Revision 4's hug (`[ a\n, b\n]`), as |
| 436 | + does a construction's field list. |
| 437 | + |
| 438 | +**Why the parser allows it.** A `{` or `else` at the start of a line |
| 439 | +continues the construct before it: the grammar's newline rules (ADR |
| 440 | +0048's adjacency, the application column) concern `(` and arguments, not |
| 441 | +blocks. The token check cannot see a change of tree, only of tokens, so |
| 442 | +this revision's reformat was also checked tree by tree: every reformatted |
| 443 | +file parses to the same tree as before, whitespace and comments aside. |
| 444 | + |
| 445 | +**Internals.** The printer had grown one copy per case: four signature |
| 446 | +builders, four brace builders, four comma-list loops, import sorting |
| 447 | +keyed twice (the printer through the AST, the token check through |
| 448 | +tokens). Each is one function now (`signature`, `statement_braces`, |
| 449 | +`comma_braces`, `comma_entries`, `import_path_key`/`import_item_key`), |
| 450 | +and the copies' divergences were bugs: |
| 451 | + |
| 452 | +- a comment after a match's `{` left the first arm unindented; |
| 453 | +- a comma's comment in a `fn` type or an effect alias made formatting |
| 454 | + refuse the file; |
| 455 | +- `import std/io.{println as p} as io` was refused: the token check |
| 456 | + took the item's `as` for the import's; |
| 457 | +- `pub trait Num<a> {` broke as `Num< a\n> {`: the trait's members were |
| 458 | + measured as part of the head's line. |
| 459 | + |
| 460 | +The repository is reformatted in this revision's diff, with `tests/ui` |
| 461 | +re-blessed (twice: a marker trailing a signature now breaks it) and the |
| 462 | +parser snapshots re-taken. |