Conversation
Entry page, three checked example pairs (Scala 3 + Haskell, hedgehog), diagrams, catalogue link, and the skill-memory update for this run. sh pages/refactorings/replace-global-state-with-parameter/run.sh ends with 'all properties passed'.
Contributor
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Entry 3 of the refactoring catalogue: Replace global state with parameter.
/refactorings/replace-global-state-with-parameter/with the full entry shape: Motivation first, The move, To and from (koan), three Before/After example pairs in Scala 3 + Haskell, Pitfalls with the functional-reading footnote, Verification, 11 references.GlobalVariables.html/Singleton.htmlandrefactoring.com/catalog/globalData.htmlare 404 — the smells are cited from the 2e book; Hevery's dead blog is cited via the Google Testing Blog post that quotes it; "State in Haskell" says state transformer, not "state-passing style").var/ Haskell top-levelIORef) threaded as explicit state through a recursive walk — in Haskell the After entry point is pure again, and the signature records it.sh pages/refactorings/replace-global-state-with-parameter/run.shends withall properties passed.withTestsclarification in brief.md (it is a member ofTest, notProperty)..gitignoregains/vendor/forbundle config set --local path vendor/bundle(system gem dir is not writable on this machine).Mutation check (review round)
<→<=at the overdraft boundaryList(-30)within 5 tests (500-test property)LitpayloadNo mutant survived; wrong-typed mutants were not used.
Adversarial probes
Lit undefinedpayload survives the numbering in both versions; the mutant that forces it fails the probe.x0, x1, …in pre-order on generated trees (self-consistency oracle).checkSequentialbecause the properties share Before's top-levelIORef.Verification
bundle exec jekyll buildexits 0.currentColor.Preview: https://www.constructive.dev/pr-preview/pr-16/refactorings/replace-global-state-with-parameter/