Skip to content

Conversation

@kim-em
Copy link
Contributor

@kim-em kim-em commented Jan 5, 2026

This PR deprecates Option.iget in favor of Option.get! (which will panic on none) or Option.getD (which takes an explicit default value).

See #mathlib4 > `Option.iget` @ 💬

🤖 Prepared with Claude Code

This PR deprecates `Option.iget` in favor of `Option.get!` (which will
panic on `none`) or `Option.getD` (which takes an explicit default value).

`Option.iget` silently returns `default` on `none`, which can hide bugs.
The alternatives make the behavior explicit.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Jan 5, 2026

PR summary 8c8bf56c91

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ getI_eq_getElem?_getD
+ getLastI_eq_getLast?_getD
+ head!_eq_head?_getD
+ option_getD_default
+ surjective_decode_getD

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@urkud
Copy link
Member

urkud commented Jan 5, 2026

Thanks! Once CI is happy, please merge this PR using bors r+
bors d+

@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Jan 5, 2026

✌️ kim-em can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Jan 5, 2026
@urkud
Copy link
Member

urkud commented Jan 5, 2026

Should we deprecate List.*I from https://leanprover-community.github.io/mathlib4_docs/Mathlib/Data/List/Defs.html too?

- Keep `option_iget` using `@Option.iget` with `set_option linter.deprecated false`
- Derive `option_getD_default` from `option_getD`
- Fix line length in MeasurableSpace/Pi.lean

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@kim-em
Copy link
Contributor Author

kim-em commented Jan 6, 2026

Good idea, but let's do that in a separate PR to keep this one focused.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@kim-em
Copy link
Contributor Author

kim-em commented Jan 6, 2026

bors merge

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the ready-to-merge This PR has been sent to bors. label Jan 6, 2026
mathlib-bors bot pushed a commit that referenced this pull request Jan 6, 2026
This PR deprecates `Option.iget` in favor of `Option.get!` (which will panic on `none`) or `Option.getD` (which takes an explicit default value).

See [#mathlib4 > &#96;Option.iget&#96; @ 💬](https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/.60Option.2Eiget.60/near/565951044)

🤖 Prepared with Claude Code
@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Jan 6, 2026

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title chore(Data/Option): deprecate Option.iget [Merged by Bors] - chore(Data/Option): deprecate Option.iget Jan 6, 2026
@mathlib-bors mathlib-bors bot closed this Jan 6, 2026
@adomani adomani mentioned this pull request Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). ready-to-merge This PR has been sent to bors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants