Re: [whatwg/url] Be clearer that URL serialization returns an ASCII string. (#428)

I think we ought to specify all return types that are produced by a sequence of steps, so that people calling algorithms can tell what they're getting out without needing to read the implementations. Doing this gets more important the longer the algorithm is, and the more sub-algorithms it calls that don't themselves describe their return types.

I think the assertion is less useful to readers than the up-top declaration, because when reading the assertion, I also have to check for any early returns that might return a different type. The assertion is still more useful than nothing.

Infra, if it defines the pattern for declaring return types, could say that every return statement implicitly includes an assertion that the types match the ones declared for the algorithm.

-- 
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/pull/428#issuecomment-461953755

Received on Friday, 8 February 2019 21:32:06 UTC