- From: Boris Zbarsky <notifications@github.com>
- Date: Mon, 17 Oct 2016 09:18:56 -0700
- To: heycam/webidl <webidl@noreply.github.com>
- Message-ID: <heycam/webidl/issues/190@github.com>
Consider this IDL: void foo(DOMString? arg); void foo(optional SomeDictionaryType arg); Is this valid? I believe it shouldn't be. `DOMString?` and `SomeDictionaryType` should not be distinguishable. But as the spec stands right now, we have: > Two types are distinguishable if at most one of the two includes a nullable type and at least one of the following three conditions is true: In this case, the first of the three conditions is true, since `DOMString` and `SomeDictionaryType` are distinguishable. Looking at the definition of "includes a nullable type" we have: > A type includes a nullable type if: > the type is a nullable type, or > the type is a union type and its number of nullable member types is 1. In this case neither type is a union type. The definition of "nullable type" is: > A nullable type is an IDL type constructed from an existing type (called the inner type), which just allows the additional value null to be a member of its set of values. Nullable types are represented in IDL by placing a U+003F QUESTION MARK ("?") character after an existing type. so only `DOMString?` is a nullable type and the two types are specced distinguishable. This used to not be broken. For example, https://web.archive.org/web/20160801174701/https://heycam.github.io/webidl/ says: > Two types are distinguishable if at most one of the two includes a nullable type or is a dictionary type, and at least one of the following three conditions is true: which makes these two types not distinguishable, since both are either nullable or dictionary.... -- 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/190
Received on Monday, 17 October 2016 16:19:49 UTC