refactor(compression): make inflated, deflated, gzipped, gunzipped and crc32 methods of Bytes #181
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/175-compression-methods"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #175
What
std/compressionis used as methods ofBytes:bytes.inflated(),.deflated(),.gzipped(),.gunzipped(),.crc32()(result types unchanged). Per the owner decision on #146 (comment on #175 of 2026-10-08) the free functions are removed, not wrapped or deprecated, and every caller is migrated in this PR:std/archive(source doc and tests),compiler/src(cli/template,cli/upgrade,package/archive), compiler tests,benchmarks/binary-formats.trb, the module docs and the regeneratedskills/.Callers write
use List.gzipped, List.gunzipped from "std/compression"(the extension member ofBytes = List<UInt8>is named by the list it extends). The internal helpers the module shares stay free functions (crcValue,crcBetween,inflateInto,deflateInto) next to the renamed entry pointsinflateAll,deflateAll,gzipMember,gunzipMembers; the five methods are declared instd/compression/src/lib.trband delegate to them.Why the methods live in lib.trb
I first wrote each method in its own file and re-exported it with
public use List.x from "./file". That does not work across a re-export: the entry handed on bybindMemberImport(compiler/src/semantics/scope.trb) keeps the originalpath, whilememberImportOfcompares it with the path the importer wrote, souse List.gzipped from "std/compression"fails with "Listis not exported by ...". Declaring theextendin the module that is imported from (asstd/timedoes forInt64.seconds) avoids it. The re-export bug is filed as #182; no compiler change here, no seed impact.Test
torb):torb format --checkon all touched.trbfiles (0 would change),torb test std/compression(11 passed, existing vectors rewritten to the method spelling),torb test std/archive(31 passed),torb check compiler/src/package compiler/src/cli benchmarks(no problems),torb docs skill docs skillsregenerated.Seed: no (ordinary
std/change, no syntax change, no new native or wellknown name).038fa8b9ec5b8f802666Approved. Checklist:
std/compressionvectors rewritten to the method spelling (CRC check value and empty input, multi-member, truncated/wrong checksum/not-gzip, reserved block, round trips);std/archiveand compiler tests migrated. CI green for5b8f802(gates, bootstrap linux-x64, tier A, pdisc).inflateAll,deflateAll,gzipMember,gunzipMembers,crcValue); signatures and result types unchanged. Declaring theextendinlib.trbis a sound workaround for the re-export limitation (filed as #182).useof the old names.std/archivedoc example and the regeneratedskills/copies are updated together; pdisc is green.Non-blocking:
std/compression/src/lib.trbline 4 of the module doc runs past the 120-column wrap used elsewhere in the file.Bytes(slice of #146) #175