leanprover / leanprover/lean4

sealing `IO` and `EIO`

Open
#187 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement P-high
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

IO (and EIO) internal implementation is still transparent.
https://github.com/leanprover/lean4/blob/151e87751301e22bb05691ac630e50b4bfec8ac5/src/Init/System/IO.lean#L15-L28
So, users can write bogus code that tries to "capture" IO.RealWorld.

@Kha this is not a high priority issue, but I can see users complaining about this all the time.
We can seal the implementation using the same approach we used to seal EnvExtension:
https://github.com/leanprover/lean4/blob/151e87751301e22bb05691ac630e50b4bfec8ac5/src/Lean/Environment.lean#L142-L149
https://github.com/leanprover/lean4/blob/151e87751301e22bb05691ac630e50b4bfec8ac5/src/Lean/Environment.lean#L239-L249
However, it is very verbose.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/Init/System/IO.lean at the linked IO and EIO definitions, then read the sealing pattern in src/Lean/Environment.lean at the referenced EnvExtension sections. Confirm that the implementation is no longer transparent and that users cannot capture IO.RealWorld while preserving the existing IO and EIO interfaces.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.