• Eric Myhre's avatar
    Several significant clarifications to Path docs. · 2e1845b3
    Eric Myhre authored
    Primarily, being commital and direct about how special values, erm...
    *aren't* -- namely, "/" is a valid segment, and so is empty string --
    and confessing how much tricky work that makes.
    
    Several methods are now more upfront about how much they *do not do
    good things* on such values.
    
    Added some new constructors for Path which *do* work for all possible
    values.  (You could've handled such tricky values with a series of
    Join calls, previously, but that would be ergonomically grueling.)
    
    These facts are all defacto 'true' to the best of my knowledge now.
    However, the IPLD specs repo is a bit on the quiet side about them
    at present (precisely because it's such an irritating little nest of
    edge cases and fun stuff)... and so the comments are also littered
    with "this may change" warnings.  Still, it's better to be accurate
    about what the code does and does not do in its current state.
    
    I'd *like* to formally specify an escaping system and canonical
    string encoding for paths.  That should start in the IPLD Specs
    repo, though, and involve fixtures, so I won't start it here now.
    
    Thanks to @ribasushi for the kick in the shins that these docs needed
    work and clarifications.
    2e1845b3
pathSegment.go 4.35 KB