Question for #scheme ☯️ kings & queens 👑 ! Are there an alternative to clojure's alter-var-root https://clojuredocs.org/clojure.core/with-redefs in scheme?
Imagine I have a module `(X)` with `(define a 1) (define-public (f x) (+ x a))` and module `(Y)` that has `#:use-module (X)`. In `(Y)` want to alter a from `(X)` in a way that would also affect `f`. Example: (being in module `(Y)`): `(alter! a 2) (equal? (f 3) 5) => #t`
@shegeley @rml @cwebber most schemers are republicans, in the anti-monarchist sense :) but if the intended use case is global monkeypatching, then in guile `set!` is your tool. if `a` is exported, then just `set!` on `a`. if not, `(set! (@@ (X) a) new-val)`