refactor(compression): make inflated, deflated, gzipped, gunzipped and crc32 methods of Bytes #181

Merged
argus merged 1 commit from loop/175-compression-methods into main 2026-10-08 08:09:33 +00:00
Collaborator

Closes #175

What

std/compression is used as methods of Bytes: 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 regenerated skills/.

Callers write use List.gzipped, List.gunzipped from "std/compression" (the extension member of Bytes = 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 points inflateAll, deflateAll, gzipMember, gunzipMembers; the five methods are declared in std/compression/src/lib.trb and 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 by bindMemberImport (compiler/src/semantics/scope.trb) keeps the original path, while memberImportOf compares it with the path the importer wrote, so use List.gzipped from "std/compression" fails with "List is not exported by ...". Declaring the extend in the module that is imported from (as std/time does for Int64.seconds) avoids it. The re-export bug is filed as #182; no compiler change here, no seed impact.

Test

  • Quick checks only (nightly-20261008 torb): torb format --check on all touched .trb files (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 skills regenerated.
  • Gates a/b and docs checks run in forge CI.

Seed: no (ordinary std/ change, no syntax change, no new native or wellknown name).

Closes #175 ## What `std/compression` is used as methods of `Bytes`: `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 regenerated `skills/`. Callers write `use List.gzipped, List.gunzipped from "std/compression"` (the extension member of `Bytes = 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 points `inflateAll`, `deflateAll`, `gzipMember`, `gunzipMembers`; the five methods are declared in `std/compression/src/lib.trb` and 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 by `bindMemberImport` (`compiler/src/semantics/scope.trb`) keeps the original `path`, while `memberImportOf` compares it with the path the importer wrote, so `use List.gzipped from "std/compression"` fails with "`List` is not exported by ...". Declaring the `extend` in the module that is imported from (as `std/time` does for `Int64.seconds`) avoids it. The re-export bug is filed as #182; no compiler change here, no seed impact. ## Test - Quick checks only (nightly-20261008 `torb`): `torb format --check` on all touched `.trb` files (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 skills` regenerated. - Gates a/b and docs checks run in forge CI. Seed: no (ordinary `std/` change, no syntax change, no new native or wellknown name).
refactor(compression): make inflated, deflated, gzipped, gunzipped and crc32 methods of Bytes
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 6s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 2m15s
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 21s
ci / bootstrap (linux-x64) (pull_request) Successful in 4m9s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier A (linux-x64) (pull_request) Failing after 3m3s
ci / gates (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
038fa8b9ec
The free functions are removed and every caller in std, compiler, tests, benchmarks and docs uses the method; the helpers the module shares (inflateAll, deflateAll, gzipMember, gunzipMembers, crcValue, crcBetween) stay. Refs #175, #146.
orion force-pushed loop/175-compression-methods from 038fa8b9ec
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 6s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 2m15s
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 21s
ci / bootstrap (linux-x64) (pull_request) Successful in 4m9s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier A (linux-x64) (pull_request) Failing after 3m3s
ci / gates (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
to 5b8f802666
All checks were successful
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
pdisc / pdisc (pull_request) Successful in 2m16s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 21s
ci / bootstrap (linux-x64) (pull_request) Successful in 4m12s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier A (linux-x64) (pull_request) Successful in 2m53s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m56s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 1m57s
ci / every host emits the same C (pull_request) Successful in 4m32s
ci / pack the seed (pull_request) Successful in 12s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
2026-10-08 07:33:44 +00:00
Compare
argus approved these changes 2026-10-08 08:09:31 +00:00
argus left a comment

Approved. Checklist:

  • Tests: ok. All existing std/compression vectors rewritten to the method spelling (CRC check value and empty input, multi-member, truncated/wrong checksum/not-gzip, reserved block, round trips); std/archive and compiler tests migrated. CI green for 5b8f802 (gates, bootstrap linux-x64, tier A, pdisc).
  • Correctness: ok. Each method delegates 1:1 to the renamed helper (inflateAll, deflateAll, gzipMember, gunzipMembers, crcValue); signatures and result types unchanged. Declaring the extend in lib.trb is a sound workaround for the re-export limitation (filed as #182).
  • Scope = task: ok. Matches #175 as amended by the owner decision on #146 (free functions removed, all callers migrated in the same PR). A grep of the head finds no remaining free-function call or use of the old names.
  • Security/data/architecture: ok. Pure refactor, no new dependency, native, boundary or format change; gzip output is unchanged.
  • Docs: ok. compression.md, index, RELEASE.md, the std/archive doc example and the regenerated skills/ copies are updated together; pdisc is green.

Non-blocking:

  • std/compression/src/lib.trb line 4 of the module doc runs past the 120-column wrap used elsewhere in the file.
Approved. Checklist: - Tests: ok. All existing `std/compression` vectors rewritten to the method spelling (CRC check value and empty input, multi-member, truncated/wrong checksum/not-gzip, reserved block, round trips); `std/archive` and compiler tests migrated. CI green for 5b8f802 (gates, bootstrap linux-x64, tier A, pdisc). - Correctness: ok. Each method delegates 1:1 to the renamed helper (`inflateAll`, `deflateAll`, `gzipMember`, `gunzipMembers`, `crcValue`); signatures and result types unchanged. Declaring the `extend` in `lib.trb` is a sound workaround for the re-export limitation (filed as #182). - Scope = task: ok. Matches #175 as amended by the owner decision on #146 (free functions removed, all callers migrated in the same PR). A grep of the head finds no remaining free-function call or `use` of the old names. - Security/data/architecture: ok. Pure refactor, no new dependency, native, boundary or format change; gzip output is unchanged. - Docs: ok. compression.md, index, RELEASE.md, the `std/archive` doc example and the regenerated `skills/` copies are updated together; pdisc is green. Non-blocking: - `std/compression/src/lib.trb` line 4 of the module doc runs past the 120-column wrap used elsewhere in the file.
argus merged commit 6410a2f987 into main 2026-10-08 08:09:33 +00:00
argus deleted branch loop/175-compression-methods 2026-10-08 08:09:33 +00:00
Sign in to join this conversation.
No reviewers
No labels
loop
ready
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!181
No description provided.