Skip to content

Commit

Permalink
Editorial: Provide a definition for "compute an effective overload se…
Browse files Browse the repository at this point in the history
…t" and use it (#727)

Fixes #308.

Thank you!
  • Loading branch information
Ms2ger authored and bzbarsky committed May 14, 2019
1 parent c1172cc commit 41e0d1e
Showing 1 changed file with 25 additions and 28 deletions.
53 changes: 25 additions & 28 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3174,7 +3174,7 @@ represents the allowable invocations for a particular
constructor (specified with [{{Constructor}}]
or [{{NamedConstructor}}]), or
[=callback function=].
The algorithm to compute an [=effective overload set=]
The algorithm to [=compute the effective overload set=]
operates on one of the following four types of IDL constructs, and listed with them below are
the inputs to the algorithm needed to compute the set.

Expand All @@ -3191,8 +3191,8 @@ the inputs to the algorithm needed to compute the set.
* the [=identifier=] of the named constructors
* the number of arguments to be passed

An effective overload set is used, among other things, to determine whether there are ambiguities in the
overloaded operations and constructors specified on an interface.
An [=effective overload set=] is used, among other things, to determine whether there are
ambiguities in the overloaded operations and constructors specified on an interface.

The [=set/items=] of an [=effective overload set=] are [=tuples=] of the form
([=effective overload set tuple/callable=], [=type list=], [=optionality list=])
Expand All @@ -3213,11 +3213,11 @@ Each [=tuple=] represents an allowable invocation of the operation,
constructor, or callback function with an argument value list of the given types.
Due to the use of [=optional arguments=]
and [=variadic=] operations
and constructors, there may be multiple items in an effective overload set identifying
and constructors, there may be multiple items in an [=effective overload set=] identifying
the same operation or constructor.

<div algorithm="compute an effective overload set">
The algorithm below describes how to compute an effective overload set.
<div algorithm="compute the effective overload set">
The algorithm below describes how to <dfn>compute the effective overload set</dfn>.
The following input variables are used, if they are required:

* the identifier of the operation or named constructor is |A|
Expand All @@ -3230,7 +3230,7 @@ the same operation or constructor.

1. Let |S| be an [=ordered set=].
1. Let |F| be an [=ordered set=] with [=set/items=] as follows,
according to the kind of effective overload set:
according to the kind of [=effective overload set=]:
<dl class="switch">
: For regular operations
:: The elements of |F| are the [=regular operations=] with
Expand Down Expand Up @@ -3599,11 +3599,11 @@ that has a given [=type list=] [=list/size=],
then for those items there must be an index |i| such that
for each pair of items the types at index |i| are [=distinguishable=].
The lowest such index is termed the <dfn id="dfn-distinguishing-argument-index" export>distinguishing argument index</dfn>
for the items of the effective overload set with the given type list size.
for the items of the [=effective overload set=] with the given type list size.

<div class="example">

Consider the effective overload set shown in the previous example.
Consider the [=effective overload set=] shown in the previous example.
There are multiple items in the set with type lists 2, 3 and 4.
For each of these type list size, the [=distinguishing argument index=] is 0, since <code class="idl">Node</code> and
<code class="idl">Event</code> are [=distinguishable=].
Expand Down Expand Up @@ -3642,7 +3642,7 @@ be the same.
};
</pre>

For argument count 4, the effective overload set is:
For argument count 4, the [=effective overload set=] is:

<pre class="set">
«
Expand Down Expand Up @@ -10651,9 +10651,8 @@ the <code>typeof</code> operator will return "function" when applied to an inter
1. Let |args| be the passed arguments.
1. Let |n| be the [=list/size=] of |args|.
1. Let |id| be the identifier of interface |I|.
1. Initialize |S| to the [=effective overload set=]
for constructors with [=identifier=] |id|
on [=interface=] |I| and with argument count |n|.
1. [=Compute the effective overload set=] for constructors with [=identifier=] |id| on
[=interface=] |I| and with argument count |n|, and let |S| be the result.
1. Let &lt;|constructor|, |values|&gt; be the result
of passing |S| and |args|.
to the [=overload resolution algorithm=].
Expand Down Expand Up @@ -10684,9 +10683,8 @@ the <code>typeof</code> operator will return "function" when applied to an inter
1. Perform [=!=] <a abstract-op>SetFunctionName</a>(|F|, |id|).
1. Let |length| be 0.
1. If |I| was declared with a [{{Constructor}}] [=extended attribute=], then
1. Initialize |S| to the [=effective overload set=]
for constructors with [=identifier=] |id| on [=interface=] |I| and
with argument count 0.
1. [=Compute the effective overload set=] for constructors with [=identifier=] |id| on
[=interface=] |I| and with argument count 0, and let |S| be the result.
1. Set |length| to the length of the
shortest argument list of the entries in |S|.
1. Perform [=!=] <a abstract-op>SetFunctionLength</a>(|F|, |length|).
Expand Down Expand Up @@ -10722,9 +10720,8 @@ implement the interface on which the
[=ECMAScript/throw=] a {{ECMAScript/TypeError}}.
1. Let |args| be the passed arguments.
1. Let |n| be the [=list/size=] of |args|.
1. Initialize |S| to the [=effective overload set=]
for named constructors with [=identifier=] |id| on [=interface=] |I|
and with argument count |n|.
1. [=Compute the effective overload set=] for named constructors with [=identifier=] |id|
on [=interface=] |I| and with argument count |n|, and let |S| be the result.
1. Let &lt;|constructor|, |values|&gt; be the result of passing |S| and
|args| to the [=overload resolution algorithm=].
1. Let |object| be the result of [=internally create a new object implementing the
Expand All @@ -10739,9 +10736,8 @@ implement the interface on which the
1. Return |O|.
1. Let |F| be [=!=] <a abstract-op>CreateBuiltinFunction</a>(|steps|, « », |realm|).
1. Perform [=!=] <a abstract-op>SetFunctionName</a>(|F|, |id|).
1. Initialize |S| to the [=effective overload set=]
for named constructors with identifier |id| on [=interface=] |I|
and with argument count 0.
1. [=Compute the effective overload set=] for named constructors with [=identifier=] |id|
on [=interface=] |I| and with argument count 0, and let |S| be the result.
1. Let |length| be the length of the shortest argument list of the entries in |S|.
1. Perform [=!=] <a abstract-op>SetFunctionLength</a>(|F|, |length|).
1. Let |proto| be the [=interface prototype object=] of [=interface=] |I| in |realm|.
Expand Down Expand Up @@ -11253,9 +11249,10 @@ in which case they are exposed on every object that [=implements=] the interface
1. Set |idlObject| to the IDL [=interface type=] value that represents a reference
to |esValue|.
1. Let |n| be the [=list/size=] of |args|.
1. Let |S| be the [=effective overload set=] for [=regular operations=] (if |op| is a
regular operation) or for [=static operations=] (if |op| is a static operation) with
[=identifier=] |id| on |target| and with argument count |n|.
1. [=Compute the effective overload set=] for [=regular operations=] (if |op| is a
regular operation) or for [=static operations=] (if |op| is a static operation)
with [=identifier=] |id| on |target| and with argument count |n|, and let |S| be
the result.
1. Let &lt;|operation|, |values|&gt; be the result of passing
|S| and |args| to the [=overload resolution algorithm=].
1. Let |R| be <emu-val>null</emu-val>.
Expand All @@ -11282,9 +11279,9 @@ in which case they are exposed on every object that [=implements=] the interface
1. Otherwise, end these steps and allow the exception to propagate.
1. Let |F| be [=!=] <a abstract-op>CreateBuiltinFunction</a>(|steps|, « », |realm|).
1. Perform [=!=] <a abstract-op>SetFunctionName</a>(|F|, |id|).
1. Let |S| be the [=effective overload set=] for [=regular operations=] (if |op| is a regular
operation) or for [=static operations=] (if |op| is a static operation) with [=identifier=] |id|
on |target| and with argument count 0.
1. [=Compute the effective overload set=] for [=regular operations=] (if |op| is a regular
operation) or for [=static operations=] (if |op| is a static operation) with [=identifier=]
|id| on |target| and with argument count 0, and let |S| be the result.
1. Let |length| be the length of the shortest argument list in the entries in |S|.
1. Perform [=!=] <a abstract-op>SetFunctionLength</a>(|F|, |length|).
1. Return |F|.
Expand Down

0 comments on commit 41e0d1e

Please sign in to comment.