Re: [whatwg/url] Proposal of .toString({ concise: true }) for nicer output with empty values (#469)

This is potentially a bit of a ramble, but I'm trying to find ways to further explain and elaborate the ideas here.

Imagine that clients and servers communicate by passing boxes to each other.  The boxes are each labeled with a `name`, and inside each box can be found the `value` -- or nothing at all.

**Current state-of-the-world**
All boxes are made from cardboard.

When the server receives an empty cardboard box, they know that client considered that name to either be null, or to be the empty-string.

**Proposed changes**
The changes proposed here provide clients with a supply of glass boxes (nb: the glass is safe enough to be flung across the internet without damage).

When a conciseness-aware client wishes to indicate that they know about a name, and they consider it to be `null` -- have no value -- then they send the server an empty glass box labeled with that name.

A conciseness-aware server can see the client intentionally sent a glass box with no contents; they are aware that the client made this decision intentionally.

If a conciseness-aware client wishes to tell the server that a name has an empty-string value, then they pick a cardboard box instead, and they send it empty to the server.

Servers that are unaware of the meaning of a glass box will continue to do what they did previously - they'll open the box and inspect the contents and choose to interpret them in whatever way they usually do (perhaps frustration that they have been sent an empty box, and/or at least some comfort that someone was thinking about them).

In practical implementation terms, the client uses the presence of the `=` in a name-value pair to deliver a standard cardboard box, and the absence of `=` to deliver a transparent glass box.  The opt-in `concise` / `standaloneKeys` parameter controls whether the server is aware of the distinction.

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

Received on Tuesday, 12 May 2020 11:24:18 UTC