collections: hide Staged and the stage types (C8) #140
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?
Context
std/iterationexportsStagedand ten per-stage iterator types without anything outside the package naming them. COLLECTIONS.md section 3.6 makes the rule: a type ispublicwhen something outside the package names it, and not otherwise.Iterate.throughis declared as answeringIterate<Output>, andstd/iteration/src/lib.trbalready says "the stage types themselves are not exported". This slice makes the declarations agree.Goal
Drop
publicfrom:Stagedinstd/iteration/src/staged.trb(thestd/streamStaged<Input, Item, Failure>is a different type and keeps itspublicand its export),std/iteration/src/stages.trb:Mapped,Filtered,FilterMapped,MappedWhile,FlatMapped,Taken,Skipped,TakenWhile,Zipped,Sorted.Queueingstayspublicand exported (a driver outside the package reaches it, STREAMS section 13 point 6). The*Mapping/*Filteringstage values instage.trbare already non-public. The rule of section 3.6 goes into the module comment ofstd/iteration/src/lib.trb.Acceptance criteria
publicremoved from exactly the eleven types above;Queueing, the traits, the stage functions andstd/stream'sStagedunchanged.std/iteration/src/lib.trbstates the rule "a type ispublicwhen something outside the package names it, and not otherwise" (and thatStagedand the stage types are the cases).docs/standard-library/iteration.md("Staged and Queueing") and the generatedskills/torbscript-standard-library/references/standard-library/iteration.mdno longer presentStagedas a name users can write;skills/regenerated.std/iterationnames the eleven types (checked:std/stream, the compiler, tests, examples). If the checker rejects a non-public type in the signature of a public member, record the message and fix the declaration, not the rule.CLAUDE.mdasks) green in CI.Source
Stagedis one name in two packages and stays one").Seed and breaking change
compiler/src;call.trbonly mentionsStaged.ofin a comment aboutstd/stream).std/iteration, and the public API (Iterate.through,map,filter, ...) is unchanged. No seed refresh needed.Size
One PR, one
refactor(std/iteration)commit (plus the docs/skills regeneration in the same commit or adocscommit). Small, as the design record estimates. The earlier ordering constraint (after C2, so two agents do not editstd/iterationat once) is met: C2/C2b/C2c are done.Dependencies
None open.
Moved from the planning lists of the docs; the design record stays the specification.
[loop:torbscript] claim refine by session:loop-torbscript-20261008 until 2026-10-08T15:40:00Z
[loop:torbscript] refine: C8 is fully decided in COLLECTIONS.md 3.6 (no open choice, no seed/syntax change, not breaking, one small PR); issue body rewritten to the definition of ready, labelled
ready, next: implement[loop:torbscript] claim implement by session:loop-torbscript-20261008 until 2026-10-08T19:40:00Z
RingList,ConsStack,BankersQueue,Heap(C7) #139[loop:torbscript] implement: PR #196 (branch
loop/140-hide-staged) is red and closed, next: waiting (owner decision: the design premise of C8 does not hold)Finding: in TorbScript
publicon a declaration is what lets a sibling file import it (compiler/src/semantics/scope.trb:use X from "./stages"reports "Xis not exported by ..., It is declared there, but notpublic"). The package boundary is separate: it is only whatstd/iteration/src/lib.trbre-exports withpublic use.Stagedand the ten stage types are already not re-exported there, so no consumer outsidestd/iterationcan name them today. Removingpublicas COLLECTIONS.md 3.6 / C8 prescribes breaksuse Staged from "./staged"anduse Mapped, Filtered, ... from "./stages"instd/iteration/src/iteration.trb; forge CIbootstrap (linux-x64)of the PR failed in step 1 witherror: an expression without a type is not supported by the native back end yet (at std/iteration/src/iteration.trb:130:5)(309 problems).Options for the owner: (a) amend 3.6/C8: the rule is "a type is exported from the package (
public usein lib.trb) when something outside names it", the declarations staypublic, and only the lib.trb comment, docs and the C8 note change (no code change); (b) move the stage types andStagedintoiteration.trbso they can be non-public (large, mechanical, Queueing stays instaged.trb); (c) add a package-private visibility to the language (syntax change, two-commit seed round). Recommendation: (a).[loop:torbscript] owner decision: C8 (COLLECTIONS.md 3.6) assumes dropping
publichidesStagedand the stage types, butpublicis also what lets a sibling file import them; the package boundary is alreadypublic useinlib.trb, which does not re-export them (finding and CI evidence in the comment above).Options: (a) amend 3.6/C8 so the declarations stay
publicand onlylib.trbdecides the package surface (docs/comment change, no code); (b) moveStagedand the stage types intoiteration.trbso they can be non-public (large mechanical change); (c) add package-private visibility to the language (syntax change, seed round). Recommendation: (a).next: waiting (owner decision)
[loop:torbscript] owner decision recorded (torben via WhatsApp, 2026-10-08 16:35 Europe/Berlin): "Große Umbauten sind kein Problem, wenn sie Sinn ergeben" (large refactors are no problem if they make sense).
Owner left the choice to Orion and ruled out size as an argument. Decided on the merits: option (a). Reason:
lib.trbwithpublic usealready is the package boundary, the types are invisible outside the package today, andpublicon a declaration means "importable by sibling files". Moving everything intoiteration.trb(b) would only work around that by building one oversized file, with no gain in what users see; package-private visibility (c) adds a second concept for a boundary the language already has. Scope: amend COLLECTIONS.md 3.6 / C8 and the doc comments, no code change. Labelledready.[question-closed] q=q1 reason=answered-elsewhere
[loop:torbscript] claim implement by session:loop-torbscript-20261008 until 2026-10-08T22:29Z
[loop:torbscript] release implement: no worker could be started (sessions_spawn: the model account is unavailable, usage limit). Nothing was changed. next: implement (ready)
[loop:torbscript] claim implement by session:loop-torbscript-20261008 until 2026-10-08T23:04Z
[loop:torbscript] implement: PR #219, CI success, next: review (waiting on the merge gate argus)
Option (a): docs/design/COLLECTIONS.md 3.6 and C8 amended (C8 marked Done, revised by 3.6; closing line updated) and the lib.trb module comment states the rule. No code change; docs/standard-library and skills/ untouched (the design record is not part of the generated skills). Worker usage: one subagent (sonnet), small.