docs: document typed paths ($pith, $iota, +pave, +pout, +stip) - #280
Open
sigilante wants to merge 1 commit into
Open
docs: document typed paths ($pith, $iota, +pave, +pout, +stip)#280sigilante wants to merge 1 commit into
sigilante wants to merge 1 commit into
Conversation
Against urbit/docs.urbit.org@08026c84b2. Typed paths were entirely undocumented. Every example below was run on a fake ship (urbit-408k-rc1.pill). Molds (stdlib/4o.md): $iota typed path segment (hoon.hoon:2105) -- either a bare @tas, or a tagged pair naming the aura of the value it holds $pith typed urbit path (hoon.hoon:2097) -- (list iota), a path whose segments carry their aura rather than being flattened to @ta Formatting functions (stdlib/4m.md): +pave path -> pith (hoon.hoon:5999); segments that match no known aura fall back to [%ta segment] +pout pith -> path (hoon.hoon:5992); the inverse, rendering each iota with +scot +stip typed path parser (hoon.hoon:5972), with its two arms: +spot:stip parse one segment +swot:stip parse a whole /-separated path The core reduces to +swot, so +stip used directly parses a path. The trap worth documenting, found by trying it rather than reading it: casting a $path to a $pith does NOT parse the segments. > (pave /foo/123/0xdead) ~[%foo [%ud 123] [%ux 0xdead]] > `pith`/foo/123 ~[%foo %123] The cast merely retypes the existing @ta segments, so `%123` stays a term rather than becoming [%ud 123]. Anyone reaching for a $pith by casting gets something that type-checks and is wrong. Noted in both $pith and +pave. All examples verified: (pave /foo/123/0xdead) ~[%foo [%ud 123] [%ux 0xdead]] (pout (pave /foo/123/0xdead)) /foo/123/0xdead (rash '123' spot:stip) [%ud 123] (rash '0xdead' spot:stip) [%ux 0xdead] (rash '/foo/123' swot:stip) [%foo [i=[%ud 123] t=~]] NOT included here: +hew. It belongs in stdlib/2c.md at exactly the insertion point the undocumented-Hoon-features PR uses for +ham, so adding it on this branch would conflict. It is being added to that branch instead, where it belongs alongside the other bit-arithmetic arms. All anchors verified to resolve. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Fifteenth PR from the audit against
urbit/urbit@08026c84b2. Typed paths were entirely undocumented. Every example was run on a fake ship (urbit-408k-rc1.pill).Companion PRs: #266, #267, #269–#279.
Molds (
stdlib/4o.md)$iota— typed path segment (hoon.hoon:2105). Either a bare@tas, or a tagged pair naming the aura of the value it holds.$pith— typed Urbit path (hoon.hoon:2097). A(list iota); a path whose segments carry their aura rather than being flattened to@ta.Formatting functions (
stdlib/4m.md)+pave—path→pith(:5999). Segments matching no known aura fall back to[%ta segment].+pout—pith→path(:5992). The inverse, rendering each$iotawith+scot.+stip— typed path parser (:5972), with+spot:stip(one segment) and+swot:stip(a whole path). The core reduces to+swot, so+stipused directly parses a path.The trap, found by trying it rather than reading it
Casting a
$pathto a$pithdoes not parse the segments.The cast merely retypes the existing
@tasegments, so%123stays a term rather than becoming[%ud 123]. Anyone reaching for a$pithby casting gets something that type-checks and is silently wrong. Noted in both the$pithand+paveentries.All examples verified
+hewwent to #272 instead+hewbelongs instdlib/2c.mdimmediately before+lsh— the same insertion point #272 already uses for+ham, so putting it here would have conflicted. It has been added to that branch instead, alongside the other bit-arithmetic arms, and #272 has been updated.Worth noting how that went: I wrote
+hew's source block from inference on a first pass and it was wrong — I had the tail as two=/bindings threadingdby hand, where the source uses=^ f d $(b -.b)twice and produces[[f g] d]. Caught by diffing againsthoon.hoonbefore commit, the same check that caught+rigearlier on that branch. All five blocks in2c.mdnow verify as exact matches.All anchors verified to resolve. Test-merged against the fourteen open companion PRs — all clean.
🤖 Generated with Claude Code