Boost logo

Boost :

Subject: Re: [boost] [filesystem] Request for commentsonproposedrelative()function
From: Peter Dimov (lists_at_[hidden])
Date: 2014-05-18 11:02:57


Yakov Galka wrote:

...

> > z1 = "/a"
> > z2 = "c:a"

...

> Is z2 absolute? Wrt. what definitions?
>
> * "Definition 1" (x / "c:" = "c:" for all x), and either yours or mine
> (equivalent) definitions of is_absolute: then z2 is absolute because x /
> z2 = z2 for all x. Then my claim that path of max-rank (here rank(drive))
> is absolute is true.
>
> * "Definition 2", ("c:" / x / "c:" = "c:" / x ...): you cannot define
> ranks for such concatenation. If you give ranks to elements you get a
> stronger framework, which, in particular, is associative.

At first, I was in favor of definition 2, stated as "x / y is the meaning of
y when the current directory is x".

    "c:/x" / "c:a" == "c:/x/a"
    "d:/x" / "c:a" == "c:a"

    "c:/x" / "/a" == "c:/a"
    "d:/x" / "/a" == "d:/a"

On second thought though, I'm not sure that this is what I'd want from
usability point of view. When the user gives me "c:a", he probably wants
"c:a" and not "c:/x/a", even if the documentation states that paths are
treated relative to "c:/x".

In addition, "x" / "c:a" is not representable.

Definition 1, then.

    "c:/x" / "c:a" == "c:a"
    "d:/x" / "c:a" == "c:a"

But then

    "c:/x" / "/a" == "/a"
    "d:/x" / "/a" == "/a"

for the same usability reasons.

In this case, both z1 and z2 are absolute (even though they are not absolute
by the N3940 definition.)


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