[heycam/webidl] Should EnforceRange be allowed on consts and return types? (#842)

WebIDL specifies that a`[EnforceRange]` types are not valid for `readonly attribute`s. However, it doesn't seem to specify whether they are valid for:

- `const`s (see [`GPUBufferUsageFlags` and `GPUBufferUsage.*`](https://gpuweb.github.io/gpuweb/#typedefdef-gpubufferusageflags))
- method return types (see usages of [`GPUFenceValue`](https://gpuweb.github.io/gpuweb/#typedefdef-gpufencevalue))

It seems like all 3 should be the same.

That said, I would argue that `EnforceRange` be valid in all of these cases, just that it would have no effect. This makes sense because: (a) it allows a `typedef` of an `[EnforceRange]` integer type to be used consistently and (b) it matches the behavior of reading from a non-readonly `attribute` (`[EnforceRange]` is meaningless/ignored).

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

Received on Tuesday, 11 February 2020 06:35:10 UTC