[whatwg/webidl] Editorial: use the exclusive range where the range can be empty (PR #1632)

Several algorithms iterated with "the range 0 to X − 1, inclusive", which is a decreasing range when X is 0. Infra only defines "the range n to m, inclusive" for m greater than or equal to n, so those cases were not well-defined, even though the empty ordered set was clearly what was intended — see for instance the note about *i* being 0 in the overload set construction.

Switch to "the range n to m, exclusive", which Infra already defines to create an empty ordered set when m equals n. This needs no Infra change.

Sites changed:

* "create an overload set": `|n|` to `|max|`, `0` to `|n|`, and `0` to `|i|`. The remaining `|n|` to `|i|`, inclusive is left alone, since `|i|` is always greater than or equal to `|n|` there.
* "get a copy of the bytes held by the buffer source", which was decreasing for a zero-length buffer source.
* "write into an `ArrayBuffer`", which was decreasing for an empty byte sequence.

This is editorial: the empty result was already what every affected step intended, so there are no behaviour changes.

- [x] At least two implementers are interested (and none opposed):
   * Editorial, so not applicable.
- [x] [Tests](https://github.com/web-platform-tests/wpt) are written and can be reviewed and commented upon at:
   * Editorial, so not applicable.
- [x] [Implementation bugs](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) are filed:
   * Editorial, so not applicable.
- [x] [MDN issue](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) is filed: editorial, so not applicable.
- [x] The top of this comment includes a [clear commit message](https://github.com/whatwg/meta/blob/main/COMMITTING.md) to use.

(See [WHATWG Working Mode: Changes](https://whatwg.org/working-mode#changes) for more details.)

You can view, comment on, or merge this pull request online at:

  https://github.com/whatwg/webidl/pull/1632

-- Commit Summary --

  * Editorial: use the exclusive range where the range can be empty

-- File Changes --

    M index.bs (17)

-- Patch Links --

https://github.com/whatwg/webidl/pull/1632.patch
https://github.com/whatwg/webidl/pull/1632.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/pull/1632
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/pull/1632@github.com>

Received on Sunday, 30 August 2026 14:06:43 UTC