Skip to content

Commit 0130145

Browse files
committed
feat: enable !-purity by default (error)
This PR makes beagle reject unmarked mutation by default: a strict-mode function whose body mutates (set! or a !-named call) must itself be named with a trailing !, or it is a compile error (E019). Opt down with BEAGLE_PURITY=off|warn. All live consumers and beagle's own corpus are clean at error. Completes the Phase 6 purity rollout: the engine shipped dark (default off), and is now flipped on after renaming the mutating functions in gjoa and the beagle test corpus to satisfy the rule.
1 parent 4e6c2fc commit 0130145

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

beagle-lib/private/check.rkt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@
4040
2))))
4141

4242
;; `!`-purity enforcement (Phase 6 — design-purity.md). Seeded from
43-
;; BEAGLE_PURITY ('off | 'warn | 'error). Phase 6.0 ships DARK: the default
44-
;; is 'off, which short-circuits check-purity! entirely so the pass is inert
45-
;; in every build and cannot turn into a new diagnostic for the live
46-
;; consumers. Mirrors the BEAGLE_CHECK_PROFILE env precedent exactly. Flip on
47-
;; per rollout stage (warn/error) without touching consumer source.
43+
;; BEAGLE_PURITY ('off | 'warn | 'error). Default is now 'error: a strict-mode
44+
;; defn whose body mutates (set! or a `!`-named call) must itself be `!`-named,
45+
;; or it is a hard compile error. Opt down with BEAGLE_PURITY=off|warn. All
46+
;; live consumers (gjoa/chelonia/nixos) and beagle's own corpus are clean at
47+
;; 'error as of the flip; mirrors the BEAGLE_CHECK_PROFILE env precedent.
4848
(define current-purity-enforcement
4949
(make-parameter
5050
(case (getenv "BEAGLE_PURITY")
51+
[("off") 'off]
5152
[("warn") 'warn]
52-
[("error") 'error]
53-
[else 'off])))
53+
[else 'error])))
5454

5555
(define (merge-types . ts)
5656
(define non-any (filter (λ (t) (not (any-type? t))) ts))

0 commit comments

Comments
 (0)