Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2021-10-18 19:37:43


> On Sun, Oct 17, 2021 at 8:56 PM Gavin Lambert via Boost
> > It's worthwhile considering these things from the start, as they can
> > inform design of your baseline (such as compatibility of path segment
> > iteration).

Segment iteration is not going to be compatible. In addition to adding
an initial "/" segment for absolute paths, Filesystem also collapses
consecutive / separators. So iterating "/foo//bar//baz///" produces

"/" │ "foo" │ "bar" │ "baz" │ ""

(https://godbolt.org/z/EsjKzc5f1)

A design goal of URL seems to be that the information that the accessors
give accurately reflects the contents of the string (and that there's no
hidden metadata that the string doesn't reflect.)

So the segments of the above path are

{ "foo", "", "bar", "", "baz", "", "", "" }

because otherwise the segments of the above and "/foo/bar/baz/" will
be the same, which means that it won't be possible to reconstruct the string
from the information the URL accessors give.

That is, if you have a string, and you construct an URL object from it, then
take its state as returned by the accessors, copy it into another empty URL,
the resultant string should be the same as the original. And similarly, if you
take an empty URL, set its parts to some values, take the string, create
another URL object from the string, the accessors should give the original
values.

Destructive transformations such as what Filesystem does above cannot
work in this model.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk