Re: [whatwg/webidl] WIP: switching maplike/setlike to use infra maps and sets (PR #1138)

@tabatkins commented on this pull request.



> @@ -11422,6 +11420,32 @@ and its value is an object called a <dfn id="dfn-legacy-factory-function" export
 which allows creation of objects that implement the interface.
 The characteristics of a legacy factory function are described in [[#legacy-factory-functions]].
 
+<div algorithm>
+    Some interface operations are defined directly over ECMAScript values,
+    rather than IDL or other spec-internal types.
+    These algorithms need to perform an [=implementation check=]
+    as their opening steps,
+    to ensure they're being called on the correct kind of object
+    and that the operation is valid to call from the given script.
+
+    To <dfn local-lt="implementation check|implementation-check">implementation-check an object</dfn> |esValue|
+    against the interface |interface|,
+    with the identifier |name|
+    and the type |type|:
+
+    1. Let |object| to [=?=] [$ToObject$](|esValue|).
+    1. If |object| is a [=platform object=],

> So, |object| is an ECMAScript object right now, so it will never be a platform object. You need to instead convert it to an ECMAScript object

One of these "ECMAScript object"s are meant to be "IDL object", right? Otherwise I don't know what you're saying.

In either case, tho, I believe my text is right in this regard - the value is definitely an ES object at this point, since I'm defining the behavior of an ES function object. And "is a platform object" *is* invoked on ES objects (as is the "implements" algo).

> (Right now your call sites are looking at the map entries of the ECMAScript object, which does not have any map entries.)

Yeah, this is a weakness. I hadn't found how to properly invoke the notion of the IDL value it's paired to.

...ah, found it, "Set idlObject to the IDL [interface type](https://github.com/whatwg/webidl/pull/1138#idl-interface) value that represents a reference to esValue." (from step 2.1.2.4 of ["create an operation function"](file:///usr/local/google/home/tabatkins/specs/webidl/index.html#dfn-create-operation-function))

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/pull/1138#discussion_r864311847
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/pull/1138/review/961160712@github.com>

Received on Tuesday, 3 May 2022 22:41:35 UTC