compression: lead with methods on Bytes (slice of #146) #175
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Goal
std/compressionis used as methods on the bytes it works on:bytes.inflated(),bytes.deflated(),bytes.gzipped(),bytes.gunzipped(),bytes.crc32().Part of #146 (methods are the preferred API style; owner direction 2026-10-06, first applied in #96 as
Digest.equalsConstantTimewithconstantTimeEqualkept as a thin wrapper). This slice follows exactly that pattern.Functions in scope
inflated,deflated,gzipped,gunzipped,crc32instd/compression(all takeBytesfirst). Keep as free functions (internal buffer helpers, not API):inflateInto,deflateInto,crcValue,crcBetween.Source (pinned record)
usethe method like any member. If anextendwithout a trait on a type of another package turns out not to work instd/, stop and re-plan instead of working around it.Acceptance criteria
std/compressionprovides the methodsBytes.inflated(),.deflated(),.gzipped(),.gunzipped()and.crc32()with the result types of the current free functionsstd/compressiontest file): for each method, the method result equals the free function result on the existing test vectors (empty, small, multi-block input, corrupt input for theResultones)deprecatedhere (the deprecation path is an open owner decision on #146).docs/standard-library/leads with the method in every example; the wrapper is listed as the older spelling. Examples are checked withtrb check;skills/is regenerated.compiler/srcandtools/keep calling the wrapper).Seed
No. Ordinary TorbScript in
std/only: no syntax change, no new native, no driver flag, no std name the compiler looks up by string. If that turns out wrong, stop and re-plan (two commits, seed refresh).Size
One PR, one Conventional Commit (
refactor(<module>): ...orfeat(<module>): ...), tests and docs in the same commit.Dependencies
Tracking epic: #146. No other dependency; independent of the other module slices.
[loop:torbscript] scope update from the owner decision on #146 (torben, 2026-10-08): the free functions covered by this slice are removed in the same PR that adds the methods, not kept as wrappers and not marked
deprecated. Migrate every caller in the repo (std, tests, examples, docs) to the method in the same PR. No lint migration rule needed.[loop:torbscript] claim implement by session:loop-torbscript-20261008 until 2026-10-08T13:15:00Z
[loop:torbscript] implement: PR #181 is open (one commit
refactor(compression): ...), forge CI green (gates, tier A, bootstrap, docs and skills checks; tier B skipped as not applicable).inflated,deflated,gzipped,gunzippedandcrc32are now methods ofBytes; the free functions are removed and all callers (std/archive, compiler/src, compiler tests, benchmarks, docs, regenerated skills) are migrated. The methods are declared instd/compression/src/lib.trb, because a re-exported extension member cannot be imported through the re-exporting module (path mismatch inbindMemberImport/memberImportOf); filed as #182 (label loop). Worker token usage: not metered in-session. next: review