Skip to content

Commit 2b1a990

Browse files
TimothyGuannevk
authored andcommitted
Remove legacy callers
Turns out there is only one interface in the Platform using legacy callers (HTMLAllCollection). Define the exotic behaviors there instead. Fixes #407. Fixes #408.
1 parent f97da39 commit 2b1a990

File tree

1 file changed

+8
-119
lines changed

1 file changed

+8
-119
lines changed

index.bs

Lines changed: 8 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,6 @@ underscore.
568568
"inherit"
569569
"interface"
570570
"iterable"
571-
"legacycaller"
572571
"maplike"
573572
"namespace"
574573
"partial"
@@ -1950,7 +1949,6 @@ The following extended attributes are applicable to operations:
19501949
"getter"
19511950
"setter"
19521951
"deleter"
1953-
"legacycaller"
19541952
</pre>
19551953

19561954
<pre class="grammar" id="prod-OperationRest">
@@ -2141,11 +2139,6 @@ is used to declare it and what the purpose of the special operation is:
21412139
<td><emu-t>deleter</emu-t></td>
21422140
<td>Defines behavior for when an object is indexed for property deletion.</td>
21432141
</tr>
2144-
<tr>
2145-
<td><dfn id="dfn-legacy-caller" export lt="legacy caller">Legacy callers</dfn></td>
2146-
<td><emu-t>legacycaller</emu-t></td>
2147-
<td>Defines behavior for when an object is called as if it were a function.</td>
2148-
</tr>
21492142
<tr>
21502143
<td><dfn id="dfn-stringifier" export lt="stringifier">Stringifiers</dfn></td>
21512144
<td><emu-t>stringifier</emu-t></td>
@@ -2231,8 +2224,6 @@ there must exist at most one
22312224
stringifier, at most one
22322225
[=named property deleter=],
22332226
and at most one of each variety of getter and setter.
2234-
Multiple legacy callers can exist on an interface
2235-
to specify overloaded calling behavior.
22362227

22372228
If an interface has a setter of a given variety,
22382229
then it must also have a getter of that
@@ -2252,73 +2243,6 @@ that defines a given special operation, then it is undefined which (if any)
22522243
special operation is invoked for that operation.
22532244

22542245

2255-
<h5 id="idl-legacy-callers">Legacy callers</h5>
2256-
2257-
When an [=interface=] has one or more
2258-
[=legacy callers=], it indicates that objects that implement
2259-
the interface can be called as if they were functions. As mentioned above,
2260-
legacy callers can be specified using an [=operation=]
2261-
declared with the <emu-t>legacycaller</emu-t> keyword.
2262-
2263-
<pre highlight="webidl" class="syntax">
2264-
interface interface_identifier {
2265-
legacycaller return_type identifier(/* arguments... */);
2266-
legacycaller return_type (/* arguments... */);
2267-
};
2268-
</pre>
2269-
2270-
If multiple legacy callers are specified on an interface, overload resolution
2271-
is used to determine which legacy caller is invoked when the object is called
2272-
as if it were a function.
2273-
2274-
[=Legacy callers=] can only be defined on interfaces that also
2275-
[=support indexed properties|support indexed=] or
2276-
[=support named properties|named properties=].
2277-
2278-
Note: This artificial restriction allows bundling all interfaces with exotic object behavior
2279-
into a single [=platform object=] category: [=legacy platform objects=].
2280-
This is possible because all existing interfaces which have a [=legacy caller=]
2281-
also [=support indexed properties|supports indexed=] or
2282-
[=support named properties|named properties=].
2283-
2284-
Legacy callers must not be defined to return a [=promise type=].
2285-
2286-
<p class="advisement">
2287-
Legacy callers are universally recognised as an undesirable feature. They exist
2288-
only so that legacy Web platform features can be specified. Legacy callers
2289-
should not be used in specifications unless required to
2290-
specify the behavior of legacy APIs, and even then this should be discussed on
2291-
the <a href="mailto:[email protected]">[email protected]</a>
2292-
mailing list before proceeding.
2293-
</p>
2294-
2295-
<div class="example">
2296-
2297-
The following [=IDL fragment=]
2298-
defines an [=interface=]
2299-
with a [=legacy caller=].
2300-
2301-
<pre highlight="webidl">
2302-
interface NumberQuadrupler {
2303-
// This operation simply returns four times the given number x.
2304-
legacycaller double compute(double x);
2305-
};
2306-
</pre>
2307-
2308-
An ECMAScript implementation supporting this interface would
2309-
allow a [=platform object=]
2310-
that implements <code class="idl">NumberQuadrupler</code>
2311-
to be called as a function:
2312-
2313-
<pre highlight="js">
2314-
var f = getNumberQuadrupler(); // Obtain an instance of NumberQuadrupler.
2315-
2316-
f.compute(3); // This evaluates to 12.
2317-
f(3); // This also evaluates to 12.
2318-
</pre>
2319-
</div>
2320-
2321-
23222246
<h5 id="idl-stringifiers">Stringifiers</h5>
23232247

23242248
When an [=interface=] has a
@@ -2797,17 +2721,13 @@ of an overloaded operation is used to invoke one of the
27972721
operations on an object that implements the interface, the
27982722
number and types of the arguments passed to the operation
27992723
determine which of the overloaded operations is actually
2800-
invoked. If an interface has multiple
2801-
[=legacy callers=] defined on it,
2802-
then those legacy callers are also said to be overloaded.
2803-
In the ECMAScript language binding, <a href="#Constructor">constructors</a>
2724+
invoked. In the ECMAScript language binding, <a href="#Constructor">constructors</a>
28042725
can be overloaded too. There are some restrictions on the arguments
2805-
that overloaded operations, legacy callers and constructors can be
2726+
that overloaded operations and constructors can be
28062727
specified to take, and in order to describe these restrictions,
28072728
the notion of an <em>effective overload set</em> is used.
28082729

2809-
[=Operations=] and [=legacy callers=]
2810-
must not be overloaded across [=interface=]
2730+
[=Operations=] must not be overloaded across [=interface=]
28112731
and [=partial interface=] definitions.
28122732

28132733
<div class="note">
@@ -2842,8 +2762,7 @@ An <dfn id="dfn-effective-overload-set" export>effective overload set</dfn>
28422762
represents the allowable invocations for a particular
28432763
[=operation=],
28442764
constructor (specified with [{{Constructor}}]
2845-
or [{{NamedConstructor}}]),
2846-
[=legacy caller=] or
2765+
or [{{NamedConstructor}}]), or
28472766
[=callback function=].
28482767
The algorithm to compute an [=effective overload set=]
28492768
operates on one of the following six types of IDL constructs, and listed with them below are
@@ -2854,9 +2773,6 @@ the inputs to the algorithm needed to compute the set.
28542773
:: * the [=interface=] on which the [=operations=] are to be found
28552774
* the [=identifier=] of the operations
28562775
* the number of arguments to be passed
2857-
: For legacy callers
2858-
:: * the [=interface=] on which the [=legacy callers=] are to be found
2859-
* the number of arguments to be passed
28602776
: For constructors
28612777
:: * the [=interface=] on which the [{{Constructor}}] [=extended attributes=] are to be found
28622778
* the number of arguments to be passed
@@ -2869,14 +2785,14 @@ the inputs to the algorithm needed to compute the set.
28692785
* the number of arguments to be passed
28702786

28712787
An effective overload set is used, among other things, to determine whether there are ambiguities in the
2872-
overloaded operations, constructors and callers specified on an interface.
2788+
overloaded operations and constructors specified on an interface.
28732789

28742790
The [=set/items=] of an [=effective overload set=] are [=tuples=] of the form
28752791
([=effective overload set tuple/callable=], [=type list=], [=optionality list=])
28762792
whose [=tuple/items=] are described below:
28772793

28782794
* A <dfn for="effective overload set tuple">callable</dfn> is an [=operation=]
2879-
if the [=effective overload set=] is for [=regular operations=], [=static operations=] or [=legacy callers=];
2795+
if the [=effective overload set=] is for [=regular operations=] or [=static operations=];
28802796
it is an [=extended attribute=] if the [=effective overload set=] is for constructors or [=named constructors=];
28812797
and it is the [=callback function=] itself if the [=effective overload set=] is for [=callback functions=].
28822798
* A <dfn>type list</dfn> is a [=list=] of IDL types.
@@ -2888,7 +2804,7 @@ whose [=tuple/items=] are described below:
28882804
or corresponds to a [=variadic=] argument.
28892805

28902806
Each [=tuple=] represents an allowable invocation of the operation,
2891-
constructor, legacy caller or callback function with an argument value list of the given types.
2807+
constructor, or callback function with an argument value list of the given types.
28922808
Due to the use of [=optional arguments=]
28932809
and [=variadic=] operations
28942810
and constructors, there may be multiple items in an effective overload set identifying
@@ -2927,9 +2843,6 @@ the same operation or constructor.
29272843
[=extended attributes=] on interface |I| whose
29282844
[=takes a named argument list|named argument lists’=]
29292845
identifiers are |A|.
2930-
: For legacy callers
2931-
:: The elements of |F| are the [=legacy callers=]
2932-
defined on interface |I|.
29332846
: For callback functions
29342847
:: The single element of |F| is the callback function itself, |C|.
29352848
</dl>
@@ -4815,8 +4728,7 @@ object that are considered to be platform objects:
48154728
[=platform objects=] that implement an [=interface=] which
48164729
does not have a [{{Global}}] or [{{PrimaryGlobal}}] [=extended attribute=],
48174730
[=support indexed properties|supports indexed=] or
4818-
[=support named properties|named properties=],
4819-
and may have one or multiple [=legacy callers=].
4731+
[=support named properties|named properties=].
48204732

48214733
In a browser, for example,
48224734
the browser-implemented DOM objects (implementing interfaces such as <code class="idl">Node</code> and
@@ -12158,29 +12070,6 @@ and [[#legacy-platform-object-set]].
1215812070
</div>
1215912071

1216012072

12161-
<h4 id="legacy-platform-object-call" oldids="call">\[[Call]]</h4>
12162-
12163-
<div algorithm="to invoke the internal [[Call]] method of legacy platform objects">
12164-
12165-
The internal \[[Call]] method of [=legacy platform object=] that implements
12166-
an [=interface=] |I| must behave as follows,
12167-
assuming |arg|<sub>0..|n|−1</sub> is the list of argument values passed to \[[Call]]:
12168-
12169-
1. If |I| has no [=legacy callers=],
12170-
[=ECMAScript/throw=] a {{ECMAScript/TypeError}}.
12171-
1. Initialize |S| to the [=effective overload set=]
12172-
for legacy callers on |I| and with argument count |n|.
12173-
1. Let &lt;|operation|, |values|&gt; be the result of passing |S| and
12174-
|arg|<sub>0..|n|−1</sub> to the [=overload resolution algorithm=].
12175-
1. Perform the actions listed in the description of the legacy caller |operation| with
12176-
|values| as the argument values.
12177-
1. Return the result of [=converted to an ECMAScript value|converting=]
12178-
the return value from those actions to an ECMAScript value of the type
12179-
|operation| is declared to return (or <emu-val>undefined</emu-val>
12180-
if |operation| is declared to return {{void}}).
12181-
</div>
12182-
12183-
1218412073
<h4 id="legacy-platform-object-preventextensions" oldids="preventextensions">\[[PreventExtensions]]</h4>
1218512074

1218612075
<div algorithm="to invoke the internal [[PreventExtensions]] method of legacy platform objects">

0 commit comments

Comments
 (0)