Re: path constructors and the next draft
Peter Bex 25 Sep 2026 12:59 UTC
On Fri, Sep 25, 2026 at 12:40:56PM +0000, D Guthrie wrote:
> I'd like to understand what sort of conventions there are in the community. Vectors seemed sensible to me to return in a high-level interface, because paths are naturally represented as sequences, and general purpose applications of these (like library modules) can get large quickly.
I've yet to see any sizeable paths consisting of more than a handful of
segments.
In fact, to me it makes more sense to model this as a list, because a
very common pattern in server-side code is to partially match a path
prefix, strip that and pass the remainder to the handler for the matched
path (as arguments, or for further hierarchical processing).
It makes hosting under a sub-path also easier, which is something that's
notoriously difficult for a lot of web applications because they operate
only on full URLs due to limitations in the frameworks and, more
critically, the clunky URL libraries in popular languages.
Similarly, in client-side code such as wget, if you recursively fetch a
web page, it'll crawl the pages and create a directory hierarchy on disk
which naturally mirrors the path segments on the remote server. This
would require similar type of handling, where a component gets
stripped, its directory opened/created and recurring over the remainder.
> But the generalised sequence libraries like mappings offer procedures which work on alists, and of course `build-path` is implicitly working on a list (of args) representatin. I'm simly not sure how to align the behaviour nicely.
I'd just get rid of the vector representation, to me it makes little
sense to do that.
Cheers,
Peter