Email list hosting service & mailing list manager

URI pre-SRFI for review John Cowan (13 Nov 2020 05:07 UTC)
Re: URI pre-SRFI for review Peter Bex (13 Nov 2020 07:30 UTC)

Re: URI pre-SRFI for review Peter Bex 13 Nov 2020 07:29 UTC
On Fri, Nov 13, 2020 at 12:07:02AM -0500, John Cowan wrote:
> https://github.com/johnwcowan/r7rs-work/blob/master/UrisCowan.md
>
> Comments?

Hi John,

There seems to be some confusion regarding relative references,
URIs and absolute URIs (or maybe not, I just can't really tell
from the document).

> (uri-absolute? uri-object)
>
> Returns #t if uri-object represents an absolute URI; that is, if the fragment component is #f.
>
> (uri-relative? uri-object)
>
> Returns #t if uri-object represents a relative reference as defined in RFC 3986.

In the terminology of the RFC, an URI *always* has a scheme and
hierarchical part.  A relative reference is something that looks
like "an URI without a scheme".

It doesn't seem too clear from the rest of the document, but it seems to
me that what is called an "URI" object is actually an URI or a relative
reference. In the RFC they call this encompassing thing a "URI reference".
I think the original RFC authors made quite a mistake there not to come
up with a better term.  In the CHICKEN uri-generic egg, we follow the
RFC terminology, and you'll see predicates like uri-reference?, uri?,
relative-ref? and absolute-uri? to distingiush between them.  The
documentation also clearly spells out what things are considered absolute
URIs.

If it is indeed as I suspect and the "loose" definition of URI is used
in the pre-SRFI, the uri-absolute? predicate description seems to say
that the following evaluations happen:

(uri-absolute? (parse-uri "/relative")) => #true
(uri-absolute? (parse-uri "//other-host/relative")) => #true
(uri-absolute? (parse-uri "http://my-host/relative")) => #true
while
(uri-absolute? (parse-uri "/relative#bar")) => #false
(uri-absolute? (parse-uri "//other-host/relative#bar")) => #false
(uri-absolute? (parse-uri "http://my-host/relative#bar")) => #false

While I'm not a huge fan of the confusion of what URI really means,
I understand that in common parlance, "/relative" would be called a
URI as well, but the document should make it absolutely clear whether
uri-absolute? returns #true on relative references as well, or not.

Cheers,
Peter