Std.Http minor cleanups
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
While exploiting the long weekend and reading over the Std.Http code (which is very nice code!) I tweaked some things that I came across and, since the documented contribution flow involves creating an issue, I'm creating this. These changes hardly seemed worth individual issues, and barely seem worth this one. So please ignore this issue without comment, or copy any of this into your own ongoing changes, or whatever is more helpful.
- Dispatch pending requests immediately. This does seem to move the needle on serving trivial bodies by avoiding creating so many Tasks (per
http_server_tcp.lean), and it's a very small change. (This is probably the least completely-useless change here.) - Avoid
String.toListat runtime. I thinkString.leanis converting to lists at runtime. (Although perhaps the compiler can optimise that away?) But it didn't seem to be necessary and it was a fun exercise to avoid it. IndexMultiMap.updaterebuilds the whole map but doesn't need to. Since the shape of the structure isn't changed by mapping the values, a full rebuild can be avoided here.IndexMultiMaphas required, but undocumented invariants. Likely excessive: I noticed that a couple of extra invariants were implicitly required here but not specified, so why not waste time showing that clearly true things are true? Quite possibly this just makes the code harder to change in the future.- Drop a superfluous
Open: utterly trivial, an already-open namespace is opened again.
AI: code edits are done by hand, proofs are not. Even in the simple cases where I can bumble through the proof in VS Code, the model can do it in one line. In #4, it also pointed out that I had carefully written a uniqueness invariant which was just a worse version of List.noDup.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the five linked commits and the referenced Std.Http areas, including http_server_tcp.lean, String.lean, and IndexMultiMap. Start by determining which cleanup the maintainers want to pursue; done means the selected change is integrated with its accompanying proof or validation and does not regress the affected HTTP behavior.
Written by the indexing model from the issue text.
Assessment
- Domain
- networking
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100