Re: [whatwg/webidl] Add distinguishable state for cb and dictionary-like (PR #1353)

@jeremyroman approved this pull request.

Makes sense to me (though my approval isn't significant).

> @@ -3503,6 +3503,15 @@ the following algorithm returns <i>true</i>.
             <a href="#limit-bigint-numeric-overloading">a separate restriction on their use in
             overloading</a> below. Please also note <a href="#limit-bigint-numeric-unions">the
             advice about using unions of these types</a>.
+        1.  A [=callback function=] that does not have
+            [{{LegacyTreatNonObjectAsNull}}] extended attribute is
+            distinguishable from a dictionary-like category object based on
+            whether the object is [=ECMAScript/callable=]. When selecting a
+            type for the purposes of [=overload resolution algorithm=] or
+            [=union type=] selection, and the possible types are [=callback
+            function=] and disctionary-like category type, then the type is a
+            [=callback function=] if the object is [=ECMAScript/callable=].
+            Otherwise, it is a dictionary-like category type.

For clarity, even though this pull request doesn't change it, the overload resolution algorithm and algorithm "convert an ECMAScript value an to IDL union type" already handle this correctly in the Callable(V) case, as I understand it?

> +        1.  A [=callback function=] that does not have
+            [{{LegacyTreatNonObjectAsNull}}] extended attribute is
+            distinguishable from a dictionary-like category object based on
+            whether the object is [=ECMAScript/callable=]. When selecting a

```suggestion
        1.  A [=callback function=] that does not have
            [{{LegacyTreatNonObjectAsNull}}] extended attribute is
            distinguishable from a dictionary-like type. When selecting a
```

I think the second sentence clarifies that the Callable algorithm is used, but what's normatively important in this algorithm is that callback functions without LTNOAN are distinguishable from dictionary-like types. (Since this algorithm operates on WebIDL types rather than ECMAScript values, it cannot actually normatively use Callable here.) Separating them with a full stop makes that clearer to me.

As a nit, the normative sentence here should probably discuss the types rather than the objects, for the same reason.

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

Message ID: <whatwg/webidl/pull/1353/review/1583508728@github.com>

Received on Thursday, 17 August 2023 21:25:39 UTC