Re: [heycam/webidl] Conversion from specification values to IDL values to ECMAScript values (#674)

Responding to a couple of points from @herrjemand's comment...

>  For example when we try to enforce strict type checking.

I assume you mean "more strict" than WebIDL currently handles--e.g., throwing an exception rather than performing a type conversion? In order to accomplish that, you'd need to basically use the `any` IDL type (essentially skipping all but the most straightforward pass-through type matching) and then handle all the logic to accept/reject that argument/setter in spec prose. In general, this is not recommended because it makes that API deviate from the expected conventions of the platform, unnecessarily increases the testing burden for the feature, and involves writing a lot more spec prose!

> We would like to have some clarification on conversion from WebIDL to Ecmascript.

I'm not sure this issue is about the lack-of-clarity in Ecmascript-to-WebIDL (and vice-versa) conversions, which are quite precisely defined in the WebIDL spec (and rather exhaustively tested in the various reflection tests for HTML -- see the approximately 40,000 tests at https://wpt.fyi/results/html/dom). As @annevk points out above, ECMAScript and IDL values are 1:1.

For all the precise details, i.e., step-by-step conversions from all Ecmascript types to IDL types and vice-versa, see: https://heycam.github.io/webidl/#es-type-mapping



-- 
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/674#issuecomment-469859922

Received on Tuesday, 5 March 2019 21:15:43 UTC