Skip to content

Commit 759555c

Browse files
committed
Define internal slots of objects directly
Either the object being created is an ordinary object (and follows the rules for it), or we now specify the internal slots of the exotic objects. Addresses part of #655.
1 parent 4945941 commit 759555c

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

index.bs

+28-24
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMA-262
7878
text: Array; url: sec-array-objects
7979
text: ArrayBuffer; url: sec-arraybuffer-objects
8080
text: DataView; url: sec-dataview-objects
81+
text: Iterator; url: sec-iterator-interface
8182
text: Map; url: sec-map-objects
8283
text: Promise; url: sec-promise-objects
8384
text: Set; url: sec-set-objects
@@ -191,6 +192,7 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMA-262
191192
url: sec-object-internal-methods-and-internal-slots
192193
text: internal method
193194
text: internal slot
195+
text: essential internal method
194196
text: Number type; url: sec-ecmascript-language-types-number-type
195197
text: Object; for: ECMAScript; url: sec-object-type
196198
for: ordinary object; url: sec-ordinary-object-internal-methods-and-internal-slots
@@ -6719,17 +6721,6 @@ shall be treated in accordance with the rules for exotic objects.
67196721
{{HTMLAllCollection}} and {{Location}} interfaces. [[HTML]]</span>
67206722
</p>
67216723

6722-
Unless otherwise specified, exotic objects defined in this section and other specifications have the
6723-
same [=ordinary object/internal slots=] as ordinary objects, and all of the internal methods for
6724-
which alternative definitions are not given are the same as [=ordinary object/internal
6725-
methods|those=] of ordinary objects.
6726-
6727-
Unless otherwise specified, the \[[Extensible]] internal slot
6728-
of objects defined in this section has the value <emu-val>true</emu-val>.
6729-
6730-
Unless otherwise specified, the \[[Prototype]] internal slot
6731-
of objects defined in this section is {{%ObjectPrototype%}}.
6732-
67336724
Unless otherwise specified, the {{ECMAScript/typeof}} operator, when called on an
67346725
exotic object that is not a [=function object=] defined in this section and
67356726
other specifications, must return the string "<code>object</code>".
@@ -10960,11 +10951,12 @@ for that interface on which named properties are exposed.
1096010951
1. If |interface| is declared to inherit from another interface,
1096110952
then set |proto| to the [=interface prototype object=] in |realm| for the [=inherited interface=].
1096210953
1. Otherwise, set |proto| to |realm|.\[[Intrinsics]].[[{{%ObjectPrototype%}}]].
10963-
1. Let |obj| be a newly created object.
10964-
1. Set |obj|'s internal methods to the definitions specified in
10954+
1. Let |obj| be a newly created object, with the same internal slots as those of ordinary
10955+
objects specified in [=ECMA-262 Ordinary object internal methods and internal slots=].
10956+
1. Set |obj|'s [=essential internal methods=] to the definitions specified in
1096510957
[=ECMA-262 Ordinary object internal methods and internal slots=],
1096610958
unless they are specified in the the rest of [[#named-properties-object]].
10967-
1. Set |obj|'s remaining internal methods to the definitions specified below.
10959+
1. Set |obj|'s remaining [=essential internal methods=] to the definitions specified below.
1096810960
1. Set |obj|.\[[Prototype]] to |proto|.
1096910961
1. Set |obj|.\[[Extensible]] to <emu-val>true</emu-val>.
1097010962
1. Return |obj|.
@@ -11872,12 +11864,16 @@ The value of the [=function object=]’s <code class="idl">name</code> property
1187211864

1187311865
A <dfn id="dfn-default-iterator-object" export>default iterator object</dfn> for a given
1187411866
[=interface=], target and iteration kind
11875-
is an object whose \[[Prototype]] [=internal slot=] is the
11867+
is an ordinary object that implements the {{Iterator}} ECMAScript interface.
11868+
11869+
The initial value of the \[[Prototype]] [=internal slot=] of a [=default iterator object=] is the
1187611870
[=iterator prototype object=]
1187711871
for the [=interface=].
1187811872

11879-
A [=default iterator object=]
11880-
has three internal values:
11873+
The initial value of the \[[Extensible]] [=internal slot=] of a [=default iterator object=] is
11874+
<emu-val>true</emu-val>.
11875+
11876+
A [=default iterator object=] has three internal values:
1188111877

1188211878
1. its <em>target</em>, which is an object whose values are to be iterated,
1188311879
1. its <em>kind</em>, which is the iteration kind,
@@ -11897,19 +11893,24 @@ class="idl">Object.prototype.toString()</code> is called on a [=default
1189711893
iterator object=] of a given [=interface=], the [=class string=] of the
1189811894
[=iterator prototype object=] of that [=interface=] is used.
1189911895

11896+
Issue: Define creation of a [=default iterator object=] imperatively instead.
11897+
1190011898

1190111899
<h5 id="es-iterator-prototype-object">Iterator prototype object</h5>
1190211900

1190311901
The <dfn id="dfn-iterator-prototype-object" export>iterator prototype object</dfn>
1190411902
for a given [=interface=]
11905-
is an object that exists for every interface that has a
11903+
is an ordinary object that exists for every interface that has a
1190611904
[=pair iterator=]. It serves as the
1190711905
prototype for [=default iterator objects=]
1190811906
for the interface.
1190911907

11910-
The \[[Prototype]] [=internal slot=] of an [=iterator prototype object=]
11908+
The initial value of the \[[Prototype]] [=internal slot=] of an [=iterator prototype object=]
1191111909
must be {{%IteratorPrototype%}}.
1191211910

11911+
The initial value of the \[[Extensible]] [=internal slot=] of an [=iterator prototype object=]
11912+
must be <emu-val>true</emu-val>.
11913+
1191311914
<div algorithm="to invoke the next property of iterators">
1191411915

1191511916
An [=iterator prototype object=] must have a <code class="idl">next</code> data property with attributes
@@ -11961,6 +11962,8 @@ The [=class string=] of an [=iterator prototype object=] for a given [=interface
1196111962
is the result of concatenating the [=identifier=] of the [=interface=]
1196211963
and the string "<code> Iterator</code>".
1196311964

11965+
Issue: Define creation of an [=iterator prototype object=] imperatively instead.
11966+
1196411967

1196511968
<h4 id="es-maplike">Maplike declarations</h4>
1196611969

@@ -12405,13 +12408,14 @@ the Realm given as an argument.
1240512408
1. Let |targetRealm| be [$GetFunctionRealm$](|newTarget|).
1240612409
1. Set |prototype| to the [=interface prototype object=] for |interface| in
1240712410
|targetRealm|.
12408-
1. Let |slots| be « \[[Realm]], \[[PrimaryInterface]] ».
12409-
1. Let |instance| be a newly created [=ECMAScript/object=] in |realm|
12410-
with an internal slot for each name in |slots|.
12411+
1. Let |instance| be a newly created [=ECMAScript/object=] in |realm|, with the same internal
12412+
slots as those of ordinary objects specified in [=ECMA-262 Ordinary object internal
12413+
methods and internal slots=], as well as \[[Realm]] and \[[PrimaryInterface]].
12414+
1. Set |instance|.\[[Prototype]] to |prototype|.
12415+
1. Set |instance|.\[[Extensible]] to <emu-val>true</emu-val>.
1241112416
1. Set |instance|.\[[Realm]] to |realm|.
1241212417
1. Set |instance|.\[[PrimaryInterface]] to |interface|.
12413-
1. Set |instance|.\[[Prototype]] to |prototype|.
12414-
1. Set |instance|'s essential internal methods to the definitions specified in
12418+
1. Set |instance|'s [=essential internal methods=] to the definitions specified in
1241512419
[=ECMA-262 Ordinary object internal methods and internal slots=].
1241612420
1. Let |interfaces| be the [=inclusive inherited interfaces=] of |interface|.
1241712421
1. [=list/iterate|For every=] [=interface=] |ancestor interface| in |interfaces|:

0 commit comments

Comments
 (0)