Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the restrictions on members whose names match auto-generated properties #726

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
146 changes: 91 additions & 55 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3981,12 +3981,19 @@ the iterator objects returned by <code class="idl">entries</code>,
<code class="idl">keys</code>, <code class="idl">values</code>, and {{@@iterator}} are
actual [=array iterator objects=].

Interfaces with iterable declarations must not
have any [=interface members=]
named "<code>entries</code>", "<code>forEach</code>",
"<code>keys</code>", or "<code>values</code>",
or have any [=inherited interfaces=]
that have [=members=] with these names.
Interfaces with iterable declarations must not have any [=regular attributes=] or [=constants=]
named
"<code>entries</code>",
"<code>forEach</code>",
"<code>keys</code>", or
"<code>values</code>",
or have any [=inherited interfaces=] that have [=regular operations=], [=regular attributes=] or
[=constants=] with these names.

Note: Operations with these names are allowed on interfaces with iterable declarations and will
Ms2ger marked this conversation as resolved.
Show resolved Hide resolved
prevent the default implementation of these methods being added to the
[=interface prototype object=] in the ECMAScript language binding.
This allows the default behavior of these operations to be overridden.

<div class="example">

Expand Down Expand Up @@ -4132,23 +4139,30 @@ keyword is used, this includes <code class="idl">entries</code>,
For read–write maplikes, it also includes <code class="idl">clear</code>,
<code class="idl">delete</code>, and <code class="idl">set</code> methods.

Maplike interfaces must not
have any [=interface members=]
named "<code>entries</code>", "<code>forEach</code>",
"<code>get</code>", "<code>has</code>",
"<code>keys</code>", "<code>size</code>", or
Maplike interfaces must not have any [=regular attributes=] or [=constants=] named
"<code>entries</code>",
"<code>forEach</code>",
"<code>get</code>",
"<code>has</code>",
"<code>keys</code>",
"<code>size</code>", or
"<code>values</code>",
or have any [=inherited interfaces=]
that have [=members=] with these names.
Read–write maplike interfaces must not
have any [=attributes=]
or [=constants=] named
"<code>clear</code>", "<code>delete</code>",
or "<code>set</code>", or have any [=inherited interfaces=]
that have [=attributes=] or [=constants=] with these names.

Note: Operations named "<code>clear</code>", "<code>delete</code>",
or "<code>set</code>" are allowed on read–write maplike
or have any [=inherited interfaces=] that have [=regular operations=], [=regular attributes=] or
Ms2ger marked this conversation as resolved.
Show resolved Hide resolved
[=constants=] with these names.

Maplike interfaces must not have any [=regular operations=] or [=constants=] named
"<code>size</code>",
or have any [=inherited interfaces=] that have [=regular operations=], [=regular attributes=] or
[=constants=] with that name.

Read–write maplike interfaces must not have any [=regular attributes=] or [=constants=] named
"<code>clear</code>",
"<code>delete</code>", or
"<code>set</code>",
or have any [=inherited interfaces=] that have [=regular operations=], [=regular attributes=] or
[=constants=] with these names.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can interfaces inheriting from the read-write maplike have these things? Seems like they shouldn't...


Note: Operations with these names are allowed on maplike
Ms2ger marked this conversation as resolved.
Show resolved Hide resolved
interfaces and will prevent the default implementation of these methods being
added to the interface prototype object in the ECMAScript language binding.
This allows the default behavior of these operations to be overridden.
Expand Down Expand Up @@ -4226,22 +4240,28 @@ keyword is used, this includes <code class="idl">entries</code>,
For read–write setlikes, it also includes <code class="idl">add</code>,
<code class="idl">clear</code>, and <code class="idl">delete</code> methods.

Setlike interfaces must not
have any [=interface members=]
named "<code>entries</code>", "<code>forEach</code>",
"<code>has</code>", "<code>keys</code>",
"<code>size</code>", or "<code>values</code>",
or have any [=inherited interfaces=]
that have [=members=] with these names.
Read–write setlike interfaces must not
have any [=attributes=]
or [=constants=] named
"<code>add</code>", "<code>clear</code>",
or "<code>delete</code>", or have any [=inherited interfaces=]
that have [=attributes=] or [=constants=] with these names.

Note: Operations named "<code>add</code>", "<code>clear</code>",
or "<code>delete</code>" are allowed on read–write setlike
Setlike interfaces must not have any [=regular attributes=] or [=constants=] named
"<code>entries</code>",
"<code>forEach</code>",
"<code>has</code>",
"<code>keys</code>", or
"<code>values</code>",
or have any [=inherited interfaces=] that have [=regular operations=], [=regular attributes=] or
[=constants=] with these names.

Setlike interfaces must not have any [=regular operations=] or [=constants=] named
"<code>size</code>",
or have any [=inherited interfaces=] that have [=regular operations=], [=regular attributes=] or
[=constants=] with that name.

Read–write setlike interfaces must not have any [=regular attributes=] or [=constants=] named
"<code>add</code>",
"<code>clear</code>", or
"<code>delete</code>",
or have any [=inherited interfaces=] that have [=regular operations=], [=regular attributes=] or
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, what about interfaces that inherit from the read-write setlike?

[=constants=] with these names.

Note: Operations with these names are allowed on setlike
Ms2ger marked this conversation as resolved.
Show resolved Hide resolved
interfaces and will prevent the default implementation of these methods being
added to the interface prototype object in the ECMAScript language binding.
This allows the default behavior of these operations to be overridden.
Expand Down Expand Up @@ -11579,13 +11599,14 @@ if the interface has a [=setlike declaration=].

<h5 id="es-forEach">forEach</h5>

If the [=interface=] has any of the following:
If the [=interface=] does not declare a [=regular operation=] with [=identifier=]
<code class="idl">forEach</code> and has any of the following:
Ms2ger marked this conversation as resolved.
Show resolved Hide resolved

* an [=iterable declaration=]
* a [=maplike declaration=]
* a [=setlike declaration=]

then a <code class="idl">forEach</code> data property must exist with attributes
<code class="idl">forEach</code> data property must exist with attributes
{ \[[Writable]]: <emu-val>true</emu-val>, \[[Enumerable]]: <emu-val>true</emu-val>, \[[Configurable]]: <emu-val>true</emu-val> }
and whose value is a [=function object=].

Expand Down Expand Up @@ -11683,7 +11704,8 @@ property is the String value "<code>forEach</code>".

<h5 id="es-iterable-entries">entries</h5>

If the [=interface=] has an [=iterable declaration=],
If the [=interface=] does not declare a [=regular operation=] with [=identifier=]
<code class="idl">entries</code> and has an [=iterable declaration=],
then an <code class="idl">entries</code> data property must exist with attributes
{ \[[Writable]]: <emu-val>true</emu-val>, \[[Enumerable]]: <emu-val>true</emu-val>, \[[Configurable]]: <emu-val>true</emu-val> }
and whose value is a [=function object=].
Expand All @@ -11704,7 +11726,8 @@ the value of the {{@@iterator}} property.

<h5 id="es-iterable-keys">keys</h5>

If the [=interface=] has an [=iterable declaration=],
If the [=interface=] does not declare a [=regular operation=] with [=identifier=]
<code class="idl">keys</code> and has an [=iterable declaration=],
then a <code class="idl">keys</code> data property must exist with attributes
{ \[[Writable]]: <emu-val>true</emu-val>, \[[Enumerable]]: <emu-val>true</emu-val>, \[[Configurable]]: <emu-val>true</emu-val> }
and whose value is a [=function object=].
Expand Down Expand Up @@ -11745,8 +11768,8 @@ The value of the [=function object=]’s <code class="idl">name</code> property

<h5 id="es-iterable-values">values</h5>

If the [=interface=] has an
[=iterable declaration=],
If the [=interface=] does not declare a [=regular operation=] with [=identifier=]
<code class="idl">values</code> and has an [=iterable declaration=],
then a <code class="idl">values</code> data property must exist
with attributes { \[[Writable]]: <emu-val>true</emu-val>, \[[Enumerable]]: <emu-val>true</emu-val>, \[[Configurable]]: <emu-val>true</emu-val> }
and whose value is a [=function object=].
Expand Down Expand Up @@ -11919,7 +11942,8 @@ These additional properties are described in the sub-sections below.

<h5 id="es-map-size">size</h5>

There must exist a <code class="idl">size</code> property on
If |A| does not declare a [=regular attribute=] with [=identifier=]
<code class="idl">size</code>, there must exist a <code class="idl">size</code> property on
|A|’s [=interface prototype object=]
with the following characteristics:

Expand Down Expand Up @@ -11950,7 +11974,8 @@ with the following characteristics:

<h5 id="es-map-entries">entries</h5>

An <code class="idl">entries</code> data property must exist on
If |A| does not declare a [=regular operation=] with [=identifier=]
<code class="idl">entries</code>, there must exist an <code class="idl">entries</code> property on
|A|’s [=interface prototype object=]
with attributes { \[[Writable]]: <emu-val>true</emu-val>, \[[Enumerable]]: <emu-val>false</emu-val>, \[[Configurable]]: <emu-val>true</emu-val> }
and whose value is the [=function object=] that is the value of
Expand All @@ -11959,7 +11984,9 @@ the {{@@iterator}} property.

<h5 id="es-map-keys-values">keys and values</h5>

For both of <code class="idl">keys</code> and <code class="idl">values</code>, there must exist a data property with that name on
For both of <code class="idl">keys</code> and <code class="idl">values</code>,
if |A| does not declare a [=regular operation=] with that name as its [=identifier=],
there must exist a data property with that name on
|A|’s [=interface prototype object=]
with the following characteristics:

Expand All @@ -11973,7 +12000,9 @@ The value of the [=function object=]’s <code class="idl">name</code> property

<h5 id="es-map-get-has">get and has</h5>

For both of <code class="idl">get</code> and <code class="idl">has</code>, there must exist a data property with that name on
For both of <code class="idl">get</code> and <code class="idl">has</code>,
if |A| does not declare a [=regular operation=] with that name as its [=identifier=],
there must exist a data property with that name on
|A|’s [=interface prototype object=] with the following characteristics:

* The property has attributes
Expand Down Expand Up @@ -12007,7 +12036,7 @@ The value of the [=function object=]’s <code class="idl">name</code> property

<h5 id="es-map-clear">clear</h5>

If |A| does not declare a [=member=]
If |A| does not declare a [=regular operation=]
with identifier "<code>clear</code>", and
|A| was declared with a read–write maplike declaration,
then a <code class="idl">clear</code> data property with the following characteristics
Expand All @@ -12024,7 +12053,7 @@ The value of the [=function object=]’s <code class="idl">name</code> property

<h5 id="es-map-delete">delete</h5>

If |A| does not declare a [=member=]
If |A| does not declare a [=regular operation=]
with identifier "<code>delete</code>", and
|A| was declared with a read–write maplike declaration,
then a <code class="idl">delete</code> data property with the following characteristics
Expand Down Expand Up @@ -12059,7 +12088,7 @@ The value of the [=function object=]’s <code class="idl">name</code> property

<h5 id="es-map-set">set</h5>

If |A| does not declare a [=member=] with identifier "<code>set</code>",
If |A| does not declare a [=regular operation=] with identifier "<code>set</code>",
and |A| was declared with a read–write maplike declaration,
then a <code class="idl">set</code> data property with the following characteristics
must exist on |A|’s [=interface prototype object=]:
Expand Down Expand Up @@ -12136,7 +12165,9 @@ These additional properties are described in the sub-sections below.

<h5 id="es-set-size">size</h5>

A <code class="idl">size</code> property must exist on |A|’s [=interface prototype object=]
If |A| does not declare a [=regular attribute=] with [=identifier=]
<code class="idl">size</code>, there must exist a <code class="idl">size</code> property on
|A|’s [=interface prototype object=]
with the following characteristics:

* The property has attributes { \[[Get]]: |G|, \[[Enumerable]]: <emu-val>false</emu-val>, \[[Configurable]]: <emu-val>true</emu-val> },
Expand Down Expand Up @@ -12165,15 +12196,18 @@ with the following characteristics:

<h5 id="es-set-values">values</h5>

A <code class="idl">values</code> data property must exist on |A|’s [=interface prototype object=]
If |A| does not declare a [=regular operation=] with [=identifier=]
<code class="idl">values</code>, there must exist an <code class="idl">values</code> property on
with attributes { \[[Writable]]: <emu-val>true</emu-val>, \[[Enumerable]]: <emu-val>false</emu-val>, \[[Configurable]]: <emu-val>true</emu-val> }
and whose value is the [=function object=] that is the value of
the {{@@iterator}} property.


<h5 id="es-set-entries-keys">entries and keys</h5>

For both of <code class="idl">entries</code> and <code class="idl">keys</code>, there must exist a data property with that name on
For both of <code class="idl">entries</code> and <code class="idl">keys</code>,
if |A| does not declare a [=regular operation=] with that name as its [=identifier=],
there must exist a data property with that name on
|A|’s [=interface prototype object=] with the following characteristics:

* The property has attributes
Expand All @@ -12190,7 +12224,9 @@ the String value "<code>entries</code>" or "<code>keys</code>", correspondingly.

<h5 id="es-set-has">has</h5>

There must exist a <code class="idl">has</code> data property on |A|’s [=interface prototype object=]
If |A| does not declare a [=regular operation=] with [=identifier=]
<code class="idl">has</code>, there must exist an <code class="idl">has</code> property on
|A|’s [=interface prototype object=]
with the following characteristics:

* The property has attributes
Expand Down