Re: [w3c/IndexedDB] Issues with key and keyPath usage (#308)

> but `sequence<>`s are not permitted for attributes IIRC.

Right, because they produce a new object each time.  So you can't currently, in IDL, express "it's a sequence but cached somehow".  That said this is a case where something like https://github.com/heycam/webidl/issues/212 would help, because then you _could_ describe the caching in the IDL.

> I'm not sure why we haven't applied [SameObject] here.

Apart from the IDL spec only allowing `[SameObject]` on object types and this not being an object type?

> it can lift the definition from [SameObject]

[SameObject] is currently purely documentation in IDL.  It does not affect the processing model; it's the responsibility of the spec author to do that.  Again, https://github.com/heycam/webidl/issues/212 may change that if it ever gets any responses from other browser implementors...

So at the moment something special is in fact needed in the processing model, until and unless https://github.com/heycam/webidl/issues/212 is resolved by adding some way of declaring that in IDL.

`any` does not mean "an ES value" in IDL.  It means "an IDL value that can losslessly represent any ES value".  The two are still conceptually distinct, especially when you sart to think about WebAssembly bindings.  In the case of `postMessage` you're right that it's skipping a "convert this IDL value to an ES value" step, which is instead left implied.  This isn't great, imo.  Similarly, the keypath bits are skipping "convert this ES value to an IDL value" steps when storing various things inside an `any`.

It doesn't help that at least some browsers actually represent `any` as ES values in their implementations, which makes it hard for engineers working on those browsers to see a distinction...

Maybe this is all ok as long as it's clear what the conversions involved are; this just came up because someone was being confused about what `any` "is", due to people taking these shortcuts in specs....

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/IndexedDB/issues/308#issuecomment-555137920

Received on Monday, 18 November 2019 18:07:42 UTC