- From: Anne van Kesteren <notifications@github.com>
- Date: Mon, 01 Apr 2019 03:59:15 -0700
- To: heycam/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <heycam/webidl/pull/700/review/221042105@github.com>
annevk commented on this pull request. Thanks for pushing this! I think we should wait with merging this until we have support on wpt/bikeshed, implementers are on board, and we have some number of specification PRs for this (I can help a bit next week). That seems preferable to slowly changing these things as then it might end up taking a long time for a full transition with lots of (costly) hiccups along the way. > @@ -2540,6 +2542,82 @@ in which case the [=default toJSON operation=] is exposed instead. </div> +<h4 id=idl-constructors oldids="Constructor" dfn>Constructor methods</h4> + +If an [=interface=] has a [=constructor method=] member (matching +<emu-nt><a href="#prod-Constructor">Constructor</a></emu-nt>), it indicates that it is possible to +create objects that [=implement=] the [=interface=] using a [=constructor=]. + +Multiple [=constructor methods=] may appear on a given [=interface=]. +For each [=constructor method=] on the [=interface=], there will be a way to construct an instance might be* (it could throw) > + interface Circle { + constructor(); + constructor(double radius); + attribute double r; + attribute double cx; + attribute double cy; + readonly attribute double circumference; + }; + </pre> + + An ECMAScript implementation supporting these interfaces would have a \[[Construct]] property + on the <code class="idl">Circle</code> interface object which would return a new object that + [=implements=] the interface. + It would take either zero or one argument. + The <code class="idl">NodeList</code> interface object would not have a \[[Construct]] + property. I thought it would have a throwing one? And the way we'd explain how an implementation was able to create it was by passing some magical token. > The [{{NoInterfaceObject}}] extended attribute must not be specified on an interface that has any -[=static operations=] defined on it. +[=constructors=] or [=static operations=] defined on it. + +Note: Combining the [{{NoInterfaceObject}}] and [{{NamedConstructor}}] extended attribute is not +forbidden, however. Hmm, maybe it should be? I guess that would be a separate change. -- 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/700#pullrequestreview-221042105
Received on Monday, 1 April 2019 10:59:38 UTC