Skip to content

Commit

Permalink
Add the symbol type
Browse files Browse the repository at this point in the history
  • Loading branch information
domenic authored Jul 31, 2017
1 parent c21e78c commit d6c3ddb
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3069,6 +3069,9 @@ the following algorithm returns <i>true</i>.
</div></th>
<th><div>
<span>object</span>
</div></th>
<th><div>
<span>symbol</span>
</div></th>
<th><div>
<span>interface-like</span>
Expand All @@ -3093,6 +3096,7 @@ the following algorithm returns <i>true</i>.
<td>●</td>
<td>●</td>
<td>●</td>
<td>●</td>
</tr>
<tr>
<th>numeric types</th>
Expand All @@ -3104,6 +3108,7 @@ the following algorithm returns <i>true</i>.
<td>●</td>
<td>●</td>
<td>●</td>
<td>●</td>
</tr>
<tr>
<th>string types</th>
Expand All @@ -3115,24 +3120,39 @@ the following algorithm returns <i>true</i>.
<td>●</td>
<td>●</td>
<td>●</td>
<td>●</td>
</tr>
<tr>
<th>object</th>
<td class="belowdiagonal"></td>
<td class="belowdiagonal"></td>
<td class="belowdiagonal"></td>
<td></td>
<td>●</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<th>symbol</th>
<td class="belowdiagonal"></td>
<td class="belowdiagonal"></td>
<td class="belowdiagonal"></td>
<td class="belowdiagonal"></td>
<td></td>
<td>●</td>
<td>●</td>
<td>●</td>
<td>●</td>
</tr>
<tr>
<th>interface-like</th>
<td class="belowdiagonal"></td>
<td class="belowdiagonal"></td>
<td class="belowdiagonal"></td>
<td class="belowdiagonal"></td>
<td class="belowdiagonal"></td>
<td>(a)</td>
<td>●</td>
<td>●</td>
Expand All @@ -3145,6 +3165,7 @@ the following algorithm returns <i>true</i>.
<td class="belowdiagonal"></td>
<td class="belowdiagonal"></td>
<td class="belowdiagonal"></td>
<td class="belowdiagonal"></td>
<td></td>
<td></td>
<td>●</td>
Expand All @@ -3157,6 +3178,7 @@ the following algorithm returns <i>true</i>.
<td class="belowdiagonal"></td>
<td class="belowdiagonal"></td>
<td class="belowdiagonal"></td>
<td class="belowdiagonal"></td>
<td></td>
<td>●</td>
</tr>
Expand All @@ -3169,6 +3191,7 @@ the following algorithm returns <i>true</i>.
<td class="belowdiagonal"></td>
<td class="belowdiagonal"></td>
<td class="belowdiagonal"></td>
<td class="belowdiagonal"></td>
<td></td>
</tr>
</table>
Expand Down Expand Up @@ -4906,6 +4929,7 @@ type.
identifier Null
"sequence" "&lt;" TypeWithExtendedAttributes "&gt;" Null
"object" Null
"symbol" Null
"Error" Null
BufferRelatedType Null
"FrozenArray" "&lt;" TypeWithExtendedAttributes "&gt;" Null
Expand Down Expand Up @@ -5322,6 +5346,15 @@ To denote a type that includes all possible object references plus the
The [=type name=] of the
{{object}} type is “Object”.

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

The {{symbol}} type corresponds to the set of all possible symbol values. Symbol values are opaque,
non-{{object}} values which nevertheless have identity (i.e., are only equal to themselves).

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

The [=type name=] of the {{symbol}} type is “Symbol”.


<h4 id="idl-interface" dfn>Interface types</h4>

Expand Down Expand Up @@ -6327,6 +6360,9 @@ ECMAScript value type.
1. If [=Type=](|V|) is String, then
return the result of <a href="#es-DOMString">converting</a> |V|
to a {{DOMString}}.
1. If [=Type=](|V|) is Symbol, then
return the result of <a href="#es-symbol">converting</a> |V|
to a {{symbol}}.
1. If [=Type=](|V|) is Object, then
return an IDL {{object}} value that references |V|.
</div>
Expand Down Expand Up @@ -6846,6 +6882,25 @@ values are represented by ECMAScript <emu-val>Object</emu-val> values.
</p>


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

IDL {{symbol}} values are represented by ECMAScript <emu-val>Symbol</emu-val> values.

<div id="es-to-symbol" algorithm="convert an ECMAScript value to a symbol">
An ECMAScript value |V| is [=converted to an IDL value|converted=] to an IDL {{symbol}} value
by running the following algorithm:

1. If [=Type=](|V|) is not Symbol, then [=ECMAScript/throw=] a <emu-val>TypeError</emu-val>.
1. Return the IDL {{symbol}} value that is a reference to the same symbol as |V|.
</div>

<p id="symbol-to-es">
The result of [=converted to an ECMAScript value|converting=] an IDL {{symbol}} value to an
ECMAScript value is the <emu-val>Symbol</emu-val> value that represents a reference to the same
symbol that the IDL {{symbol}} represents.
</p>


<h4 id="es-interface">Interface types</h4>

IDL [=interface type=]
Expand Down

0 comments on commit d6c3ddb

Please sign in to comment.