Because the scheme defines the semantics of what comes after it. Not every URL has a host, like mailto:[email protected] (to pick an extreme case).
Right now, 'foo' on itself becomes a part of the path, not the host. See also #testReferenceResolution where you can clearly see that when there is no scheme, 'g' is always seen as a path (and these examples come from an RFC). I think that what we have now is correct. I am willing to change my mind when you point to some RFC that supports your point ;-) > On 12 Mar 2015, at 22:20, Sean P. DeNigris <[email protected]> wrote: > > On Mar 12, 2015, at 4:54 PM, Sven Van Caekenberghe-2 [via Smalltalk] <[hidden > email]> wrote: >> The scheme is not optional, it defines what (kind) the URL is. You are >> expecting behaviour such as in a browser's address bar. But there, there is >> context (you are expecting an HTTP URL). > > I did see the defaultScheme: variant. I’m not saying we should necessarily > assume HTTP. I’m just saying if someone gives us a string like 'www.hm.com’ > (which I agree is incompletely defined), why set #segments and not #host? > Even with scheme = nil, the following would be more useful: > 'www.hm.com' asUrl host = 'www.hm.com'. > 'www.hm.com' asUrl segments = m') an OrderedCollection() > Cheers, > Sean > > View this message in context: Re: ZnUrl: Constructing without Scheme > Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
