Re: [whatwg/url] Differentiate from zero-sized fragment and no fragment in url (Issue #779)

I would still like to solve this. There is a constraint around naming that makes this trickier. Namely, I don't think we want to introduce a new term for "search" or "hash". That would not work for "hostname", which has the same issue as @alwinb pointed out. We also have APIs building upon those names, e.g., `URLSearchParams` and `No-Vary-Search`, and I would strongly prefer we stay with a single term within the web-exposed universe for each of these concepts.

I see these options for API shape:

1. hasX -> boolean.
2. x -> string. Empty string to denote null in the model. `?` or `#` to denote the empty string in the model.
3. x -> null or string. Null to denote null in the model. A string to denote the string in the model (i.e., without a leading `?` or `#`).

2 is argued for above, but I personally think that is an awkward API to use as you have to use string manipulation to get to the actual value. It also does not work for "hostname". 1 or 3 seem reasonable to me, but I don't really know what name would be okay for 3.

Some options:

a. `hashData`
b. `hashString` (though this would be a better fit for 2)
c. `hashValue`

I personally prefer API shape 1, followed by 2 using the c naming scheme.

Thoughts? cc @hayatoito @valenting @domenic @rmisev 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/779#issuecomment-2512075819
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/url/issues/779/2512075819@github.com>

Received on Monday, 2 December 2024 16:37:04 UTC