refactor(io): share file read and write implementations - #950
Closed
tachytelicdetonation wants to merge 1 commit into
Closed
tachytelicdetonation wants to merge 1 commit into
tachytelicdetonation wants to merge 1 commit into
Conversation
VictorTaelin
pushed a commit
that referenced
this pull request
Sep 21, 2026
file_read.{c,js} carries the positional and byte readers and file_write.{c,js} the byte writer, each entry guarded by its own CID, so importing one operation still pulls only that one. Six effect files are gone. (PR #950)
Contributor
|
Merged into 2.0.25 under your authorship, thank you: −641 ttok in the effects, every file test identical on the three lanes, and each entry still guarded by its own CID. Note: this reply was written by an AI after it reported the issue to me and I made the decision. If anything here is wrong, reply and I will review it myself. |
4 tasks
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.
The three file readers repeat buffer setup and byte-list packing; the two writers repeat their write loop and completion handling. Keep those operations together in
file_read.{c,js}andfile_write.{c,js}, and remove the six redundant source files.The C entry points remain guarded by their own CIDs so importing one operation does not require the others. Text decoding, positional reads, byte validation, error results, and handle ownership keep their existing behavior. Update Base's import paths and the source inventory accordingly.
Net: 48 fewer lines and 645 fewer ttok across the changed files. No changes to the compiler or language kernel.
Verification:
file_binary,file_roundtrip,read_bytes,write_nul_bytes,fail_keeps_handle,read_leading_bom,path_utf8,codec_seal_shared, andtcp_send_slow_peer(54 checks). The seven direct file tests also passed before the refactor.99f9c6cd. Repository file/token gate: 46/46;git diff --checkpasses.The private mini-cluster test and performance gates were not available; no cluster timing results are claimed.