Skip to content

Commit c490bc7

Browse files
Ms2gerbzbarsky
authored andcommitted
Improve the definition of the void type. (#757)
In particular, this acknowledges that `Promise<void>` exists. This also ensures that the handling of `void` return types is defined fully. Fixes #737.
1 parent 5c57dc1 commit c490bc7

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

index.bs

+18-10
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,7 @@ defined on the same [=interface=].
20732073
The <dfn id="dfn-return-type" export>return type</dfn> of the operation is given
20742074
by the type (matching <emu-nt><a href="#prod-ReturnType">ReturnType</a></emu-nt>)
20752075
that appears before the operation’s optional [=identifier=].
2076-
A return type of <dfn id="idl-void" interface>void</dfn> indicates that the operation returns no value.
2076+
A return type of {{void}} indicates that the operation returns no value.
20772077
If the return type is an
20782078
[=identifier=] followed by <emu-t>?</emu-t>,
20792079
then the identifier must
@@ -5536,6 +5536,15 @@ value is known as its <dfn id="dfn-specific-type" export>specific type</dfn>.
55365536
(Values of [=union types=] also have
55375537
[=specific types=].)
55385538

5539+
<h4 id="idl-void" interface>void</h4>
5540+
5541+
The {{void}} type has a unique value.
5542+
5543+
It can only be used as the [=return type=] of an [=operation=] or the parameter of a
5544+
[=promise type=].
5545+
5546+
The [=type name=] of the {{void}} type is "<code>Void</code>".
5547+
55395548

55405549
<h4 oldids="dom-boolean" id="idl-boolean" interface>boolean</h4>
55415550

@@ -6892,16 +6901,15 @@ ECMAScript value type.
68926901

68936902
<h4 id="es-void">void</h4>
68946903

6895-
The only place that the {{void}} type may appear
6896-
in IDL is as the [=return type=] of an
6897-
[=operation=]. Functions on [=platform objects=]
6898-
that implement an operation whose IDL specifies a
6899-
{{void}} return type must return the
6900-
<emu-val>undefined</emu-val> value.
6904+
<p id="es-to-void">
6905+
An ECMAScript value |V| is [=converted to an IDL value|converted=] to an IDL {{void}} value by
6906+
returning the unique {{void}} value, ignoring |V|.
6907+
</p>
69016908

6902-
ECMAScript functions that implement an operation whose IDL
6903-
specifies a {{void}} return type
6904-
may return any value, which will be discarded.
6909+
<p id="void-to-es">
6910+
The unique IDL {{void}} value is [=converted to an ECMAScript value|converted=] to the
6911+
ECMAScript <emu-val>undefined</emu-val> value.
6912+
</p>
69056913

69066914

69076915
<h4 id="es-boolean">boolean</h4>

0 commit comments

Comments
 (0)