Re: [heycam/webidl] Define "usual constructor steps" (#797)

Ms2ger commented on this pull request.



> @@ -11126,13 +11126,18 @@ and is described in more detail in [[#interface-prototype-object]].
 Note: Since an [=interface object=] is a [=function object=]
 the <code>typeof</code> operator will return "function" when applied to an interface object.
 
+An interface may have <dfn export>overridden constructor steps</dfn>, which can
+change the behavior of the [=interface object=] when called or constructed. By
+default interfaces do not have such steps.
+

Maybe add a warning like we have a few already for legacy features, saying something like

> In general, constructors are described by defining a [=constructor operation=] and its behavior.
> The [=overridden constructor steps=] are used only for more complicated situations. 
> Editors who wish to use this feature are strongly advised to discuss this by filing an issue before proceeding.

>  <div algorithm>
 
     The [=interface object=] for a given [=interface=] |I|
     with [=identifier=] |id| and in [=Realm=] |realm|
     is <dfn lt="create an interface object">created</dfn> as follows:
 
-    1.  Let |steps| be the following steps:
+    1.  Let |steps| be |I|'s [=overriden constructor steps=] if they exist, or
+        the following steps otherwise:
         1.  If |I| was not declared with a [=constructor operation=],
             then [=ECMAScript/throw=] a {{ECMAScript/TypeError}}.
         1.  If {{NewTarget}} is <emu-val>undefined</emu-val>, then

Should we keep the first two steps, even when overriding the rest of the algorithm?

Maybe also the last four steps?

-- 
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/797#pullrequestreview-289739015

Received on Wednesday, 18 September 2019 08:12:11 UTC