Type to represent URIs?
Neia Neutuladh
neia at ikeran.org
Wed Jan 30 17:21:25 UTC 2019
On Wed, 30 Jan 2019 15:17:28 +0000, Jesse Phillips wrote:
> I like std.path it does not use a path type and works directly off
> strings. There are benefits to a path type, but I don't know if that is
> enough.
>
> So I think I would prefer a uri library doing the same thing.
I admit I didn't even consider that when writing urld. Now that I'm
considering it, it seems like a tiny benefit in memory usage at a cost of
having to re-parse large portions of the URL each time you want to
manipulate it.
If you are only going to extract one part of a URL, it's better to use
string everywhere. If you are going to manipulate a URL in several ways in
a narrow section of code, you can use string at rest and in transit, then
use the types provided by Vibe or urld only when you need to extract data
or modify a URL. Or provide overloads for both, maybe.
More information about the Digitalmars-d
mailing list