- From: Boris Zbarsky <notifications@github.com>
- Date: Sun, 17 Nov 2019 21:49:25 -0800
- To: heycam/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <heycam/webidl/issues/823/554862858@github.com>
Any time `any` is used as a return value, the underlying algorithm could create the IDL `any` value from any type of IDL value, right? When the `any` is then converted to an ES value, the specific rules for the type of IDL value it was created from would need to be applied. As a specific example, `CustomElementRegistry.prototype.get` sometimes returns a `Function` instance (which is not one of the types https://heycam.github.io/webidl/#es-to-any produces, note) and sometimes returns undefined. Now there are definitely some specs that seem to think that `any` means "an ES value". The `IDBCursor.prototype.key` getter certainly seems to think that... On the other hand, the `IDBObjectStore.prototype.keyPath` getter does the expected thing and treats `any` as a union of IDL values; in this case it assigns either a `DOMString` of a `sequence<DOMString>` to it... but of course that's actually wrong, because it should be returning the same thing each time in the sequence case, so the spec steps there are kinda wrong and you have to ignore them and do something else. :( Most places that use `any` either pass it through as opaque or do ES-to-IDL conversions, of course. > (It’s also a bit confusing that it’s defined as “the union of all other possible non-union types,” since unsigned long and long can’t coexist in a union.) That's union in the sense of general CS concepts, not an IDL union type. I mean an `any` can also be any interface type, even though some interface types are not distinguishable. -- 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/823#issuecomment-554862858
Received on Monday, 18 November 2019 05:49:27 UTC