Re: [heycam/webidl] Define "implements" checks using internal slots (#595)

littledan commented on this pull request.



> @@ -12337,18 +12336,73 @@ The value of the [=function object=]’s <code class="idl">name</code> property
 
 <h3 id="es-platform-objects">Platform objects implementing interfaces</h3>
 
+<div algorithm>
+    An ECMAScript value |value| <dfn id="es-is-platform-object">is a platform object</dfn>
+    if [$Type$](|value|) is Object and if |value| has a \[[PrimaryInterface]] internal slot.
+</div>
+
+<div algorithm>
+    An ECMAScript value |value| <dfn export>implements</dfn> an [=interface=] |interface|
+    if |value| [=is a platform object=] and one of the following is true:
+    <ul>
+        <li>|value|.\[[PrimaryInterface]] is |interface|.</li>
+        <li>The set of [=inherited interfaces=] of |value|.\[[PrimaryInterface]] contains |interface|.</li>

One thing we could do is explain what an interface is in terms of internal slots, so it doesn't sound like we're searching through all the interfaces to find the set of inherited interfaces, or "cache" the set of inherited interfaces. But this seems like excessive formalism for no particular purpose--it's pretty clear how to represent these with efficient data structures.

-- 
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/pull/595#discussion_r240159605

Received on Monday, 10 December 2018 10:39:00 UTC