fix(stdlib): single-ownership dedup of prelude/option/result (#133)#152
Merged
Conversation
Per ADR-011 (#132): one canonical binding per name, module-owned. - prelude.affine: `module prelude;`. Keeps the core sum types `Option`/`Result` (+ constructors) as their canonical home and the generic list/numeric utilities. Removes the 8 duplicate/conflicting Option/Result *operations* it previously also defined (is_some, is_none, unwrap, unwrap_or, is_ok, is_err, unwrap_result, unwrap_or_result). - option.affine: `module option;` + `use prelude::{Option, Some, None, Result, Ok, Err};`. Now the single canonical home for Option ops. - result.affine: `module result;` + `use prelude::{Result, Ok, Err, Option, Some, None};`. Single canonical home for Result ops. The previous flat-namespace conflicts (`prelude.map(arr,f)` vs `option.map(f,opt)`; `prelude.unwrap`(Option) vs `result.unwrap`(Result)) are resolved by module ownership — each is now `module::name`, exactly one definition per owning module. Verified: no leftover dup defs, no prelude util calls a removed op, full suite green (214 tests). Note: this removes the prelude `unwrap`/`unwrap_result` that #134 (PR #150) patched; the sound, panicking versions are `option::unwrap` and `result::unwrap` (already correct). #150's regression tests remain valid against those. Merge-order: if #150 lands first, resolve the modify/delete in prelude.affine in favour of this deletion. Closes #133 Refs #128, #132 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
557f00b to
6bf9028
Compare
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.
What
Fixes #133 — removes the duplicate & signature-divergent definitions across
prelude/option/resultso there is exactly one canonical binding per name, per ADR-011 (#132): real modules + single ownership.Ownership
preludeOption/Result(+ ctors); generic list/numeric utils (map(arr),filter(arr),fold,contains(arr),sum,min,range, …)optionis_some/is_none/unwrap/unwrap_or/map/filter/contains/…)resultis_ok/is_err/unwrap/unwrap_or/map_ok/…)prelude.affinedrops the 8 duplicate/conflicting Option/Result ops it previously also defined;option/resultdeclaremodule+use prelude::{…}for the types.The old flat-namespace conflicts (
prelude.map(arr,f)vsoption.map(f,opt);prelude.unwrap(Option) vsresult.unwrap(Result)) are nowmodule::name— exactly one definition per owning module ("or properly module-qualified ones", per the issue).Verification
Merge note
This removes the
preludeunwrap/unwrap_resultthat #134 (PR #150) patched. The sound, panicking versions areoption::unwrap/result::unwrap(already correct); #150's regression tests stay valid against those. If #150 lands first, resolve the modify/delete inprelude.affinein favour of this deletion.Depends on the #132 decision (ADR-011). Closes #133. Refs #128.
🤖 Generated with Claude Code