Re: [whatwg/url] Editorial: algorithms can now have default argument values (#575)

@domenic requested changes on this pull request.



> @@ -525,11 +525,9 @@ decisions made, i.e. whether to use the <a>same site</a> or <a>schemelessly same
 <h3 id=idna>IDNA</h3>
 
 <p>The <dfn id=concept-domain-to-ascii>domain to ASCII</dfn> algorithm, given a <a>string</a>
-<var>domain</var> and optionally a boolean <var>beStrict</var>, runs these steps:
+<var>domain</var> and an optional boolean <var>beStrict</var> (default false), runs these steps:

Needs dfn (and since this is internal you can also update the call sites)

> @@ -614,11 +612,10 @@ requires context to be distinguished.
 <h3 id=host-parsing>Host parsing</h3>
 
 <p>The <dfn export id=concept-host-parser lt="host parser|host parsing">host parser</dfn> takes a
-string <var>input</var> with an optional boolean <var>isNotSpecial</var>, and then runs these steps:
+string <var>input</var> with an optional boolean <var>isNotSpecial</var> (default false), and then

Needs dfn (and since this is internal you can also update the call sites)

> @@ -1626,8 +1623,9 @@ different document encoding. Using the <a>UTF-8</a> encoding everywhere solves t
 <h3 id=url-parsing>URL parsing</h3>
 
 <p>The <dfn export id=concept-url-parser lt="URL parser">URL parser</dfn> takes a string
-<var>input</var>, with an optional <a>base URL</a> <var>base</var> and an optional
-<a for=/>encoding</a> <var>encoding override</var>, and then runs these steps:
+<var>input</var>, with an optional null or <a>base URL</a> <var>base</var> (default null) and an

Needs dfn (and since this is internal you can also update the call sites)

> @@ -1656,14 +1653,16 @@ different document encoding. Using the <a>UTF-8</a> encoding everywhere solves t
 <hr>
 
 <p>The <dfn export id=concept-basic-url-parser lt="basic URL parser">basic URL parser</dfn> takes a
-string <var>input</var>, optionally with a <a>base URL</a> <var>base</var>, optionally with an
-<a for=/>encoding</a> <var>encoding override</var>, optionally with a <a for=/>URL</a>
-<var>url</var> and a state override <var>state override</var>, and then runs these steps:
+string <var>input</var>, with an optional null or <a>base URL</a> <var>base</var> (default null), an

Needs dfn

> @@ -1656,14 +1653,16 @@ different document encoding. Using the <a>UTF-8</a> encoding everywhere solves t
 <hr>
 
 <p>The <dfn export id=concept-basic-url-parser lt="basic URL parser">basic URL parser</dfn> takes a
-string <var>input</var>, optionally with a <a>base URL</a> <var>base</var>, optionally with an
-<a for=/>encoding</a> <var>encoding override</var>, optionally with a <a for=/>URL</a>
-<var>url</var> and a state override <var>state override</var>, and then runs these steps:
+string <var>input</var>, with an optional null or <a>base URL</a> <var>base</var> (default null), an
+optional <a for=/>encoding</a> <var>encoding</var> (default <a>UTF-8</a>), an optional

Needs dfn

>  
 <ol>
  <li><p>Let <var>serializedA</var> be the result of <a lt="URL serializer">serializing</a>
- <var>A</var>, with the <i>exclude fragment flag</i> set if the
- <i>exclude fragments flag</i> is set.
+ <var>A</var>, with <a for="URL serializer"><var>exclude fragment</var></a> set to

We kind of settled on `<i>` at call sites instead of `<var>`, although it mostly only matters if you're using Bikeshed's `algorithm=""` feature. https://github.com/whatwg/infra/issues/320#issuecomment-692785334 https://github.com/whatwg/infra/pull/325#issuecomment-703493261

> @@ -2786,14 +2782,12 @@ takes a byte sequence <var>input</var>, and then runs these steps:
 
 <p>The
 <dfn export id=concept-urlencoded-serializer lt="urlencoded serializer"><code>application/x-www-form-urlencoded</code> serializer</dfn>
-takes a list of name-value tuples <var>tuples</var>, optionally with an <a for=/>encoding</a>
-<var>encoding override</var>, and then runs these steps:
+takes a list of name-value tuples <var>tuples</var>, with an optional <a for=/>encoding</a>
+<var>encoding</var> (default <a>UTF-8</a>), and then runs these steps:

Needs dfn

>  
 <ol>
- <li><p>Let <var>encoding</var> be <a>UTF-8</a>.
-
- <li><p>If <var>encoding override</var> is given, then set <var>encoding</var> to the result of
- <a lt="get an output encoding">getting an output encoding</a> from <var>encoding override</var>.
+ <li><p>If <var>encoding</var> is not <a>UTF-8</a>, then set <var>encoding</var> to the result of

As above, probably not worth the branch

> @@ -1690,12 +1689,8 @@ string <var>input</var>, optionally with a <a>base URL</a> <var>base</var>, opti
  <li><p>Let <var>state</var> be <var>state override</var>
  if given, or <a>scheme start state</a> otherwise.
 
- <li><p>If <var>base</var> is not given, set it to null.
-
- <li><p>Let <var>encoding</var> be <a>UTF-8</a>.
-
- <li><p>If <var>encoding override</var> is given, set <var>encoding</var> to the result of
- <a lt="get an output encoding">getting an output encoding</a> from <var>encoding override</var>.
+ <li><p>If <var>encoding</var> is not <a>UTF-8</a>, then set <var>encoding</var> to the result of
+ <a>getting an output encoding</a> from <var>encoding</var>.

Yeah, I think that adds a bit more confusion than it saves

-- 
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/575#pullrequestreview-580594983

Received on Monday, 1 February 2021 17:41:12 UTC