[whatwg/webidl] Consider switching the default to [EnforceRange] (Issue #1629)

twiss created an issue (whatwg/webidl#1629)

### What is the issue with the Web IDL Standard?

(This came up in https://github.com/w3c/webcrypto/issues/429#issuecomment-3916606836.)

Currently, the default for integer types is for values outside the range of the type to be reduced modulo the maximum value. But, it's a bit unclear how often we actually want that behavior, especially for new usages.

Perhaps it may be worth switching the default for integer types to be `[EnforceRange]`, and create a new extended attribute for when you want the current behavior, perhaps `[Modulo]` or some such?

If it seems reasonable, I can make a PR, though I realize this would likely cause churn in other specs.

(This would also resolve https://github.com/whatwg/webidl/issues/842 in the sense that when reusing a type between values that get passed and returned, you don't need any annotation when you want the `[EnforceRange]` behavior when passing the value. Having a `[Modulo]` attribute on a type that only ever gets returned would still be surprising/unexpected, as today with `[EnforceRange]`.)

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

Message ID: <whatwg/webidl/issues/1629@github.com>

Received on Thursday, 20 August 2026 15:20:35 UTC