Re: [heycam/webidl] record with arbitrary value types as keys? (#509)

> Okay, in that case I could also change it to Maplike<RTCQualityLimitationReason, double>

No, you couldn't.  `maplike` declarations are a thing that goes on interfaces, not a type.  You _could_ define an interface that's maplike, of course, depending on what the rest of your API looks like.

In practice, the only reason to use the enum type instead of DOMString in the "return to JS" case is for documentation purposes.  The spec prose still has to specify exactly what keys are stored in the record.  In the integer case, theoretically the only reason is documentation, but in practice it may be more efficient to create the JS object if it's known that the keys are integers.

Apart from implementation complexity, the other drawback of adding these things is that in the _other_ direction (coming from JS) there are various questions about how these key types should work...

-- 
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/509#issuecomment-356683558

Received on Wednesday, 10 January 2018 17:56:58 UTC