Skip to content

Define ModuleNamespace to ECMA-262 Module Namespace Exotic Object #1483

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -5730,6 +5730,7 @@ are known as <dfn id="dfn-object-type" export>object types</dfn>.
"async iterable" "&lt;" TypeWithExtendedAttributes "&gt;" Null
"object" Null
"symbol" Null
"ModuleNamespace" Null
BufferRelatedType Null
"FrozenArray" "&lt;" TypeWithExtendedAttributes "&gt;" Null
"ObservableArray" "&lt;" TypeWithExtendedAttributes "&gt;" Null
Expand Down Expand Up @@ -6043,6 +6044,18 @@ To denote a type that includes all possible object references plus the
<emu-val>null</emu-val> value, use the [=nullable type=]
<code class="idl">object?</code>.

<h4 id="idl-ModuleNamespace" interface>ModuleNamespace</h4>

The {{ModuleNamespace}} type corresponds to the set of all possible non-null
references to module namespace exotic objects as defined in the ECMAScript
specification.

There is no way to represent a constant {{ModuleNamespace}} value in IDL.

To denote a type that includes all possible references to module namespace
objects plus the <emu-val>null</emu-val> value, use the [=nullable type=]
<code class="idl">ModuleNamespace?</code>.

<h4 id="idl-symbol" interface>symbol</h4>

The {{symbol}} type corresponds to the set of all possible symbol values. Symbol values are opaque,
Expand Down Expand Up @@ -7795,6 +7808,27 @@ values are represented by JavaScript Object values.
</p>


<h4 id="js-module-namespace" oldids="es-module-namespace">ModuleNamespace</h4>

IDL {{ModuleNamespace}} values are represented by JavaScript module namespace exotic objects.

<div id="js-to-module-namespace" algorithm="convert a JavaScript value to ModuleNamespace">
A JavaScript value |V| is [=converted to an IDL value|converted=] to an IDL {{ModuleNamespace}}
value by running the following algorithm:

1. If |V| [=is not an Object=], or |V| is not a module namespace exotic object,
then [=JavaScript/throw=] a <l spec=ecmascript>{{TypeError}}</l>.
1. Return the IDL {{ModuleNamespace}} value that is a reference
to the same object as |V|.
</div>

<p id="module-namespace-to-js">
The result of [=converted to a JavaScript value|converting=] an IDL {{ModuleNamespace}} value
to a JavaScript value is the Object value that represents a reference to the same object that
the IDL {{ModuleNamespace}} represents.
</p>


<h4 id="js-symbol" oldids="es-symbol">symbol</h4>

IDL {{symbol}} values are represented by JavaScript Symbol values.
Expand Down