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
89 changes: 47 additions & 42 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3981,12 +3981,13 @@ 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, their [=inherited interfaces=], and any [=interfaces=] that
[=interface/inherit=] from them must not have any [=regular operations=], [=regular attributes=] or
[=constants=] named
"<code>entries</code>",
"<code>forEach</code>",
"<code>keys</code>", or
"<code>values</code>".

<div class="example">

Expand Down Expand Up @@ -4132,23 +4133,25 @@ 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
"<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
Maplike interfaces, their [=inherited interfaces=], and any [=interfaces=] that
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it worth factoring out the "interface, its inherited interfaces, and all interfaces that inherit from it" concept so it can be reused, instead of copy/pasting it?

[=interface/inherit=] from them must not have any [=regular operations=], [=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>".

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 read–write maplike
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 +4229,24 @@ 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, their [=inherited interfaces=], and any [=interfaces=] that
[=interface/inherit=] from them must not have any [=regular operations=], [=regular attributes=] or
[=constants=] named
"<code>entries</code>",
"<code>forEach</code>",
"<code>has</code>",
"<code>keys</code>",
"<code>size</code>", or
"<code>values</code>".

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 read–write setlike
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 @@ -12007,7 +12012,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 +12029,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 +12064,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