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

Add the symbol type #377

Merged
merged 1 commit into from
Jul 31, 2017
Merged
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
55 changes: 55 additions & 0 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3072,6 +3072,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 @@ -3096,6 +3099,7 @@ the following algorithm returns <i>true</i>.
<td>●</td>
<td>●</td>
<td>●</td>
<td>●</td>
</tr>
<tr>
<th>numeric types</th>
Expand All @@ -3107,6 +3111,7 @@ the following algorithm returns <i>true</i>.
<td>●</td>
<td>●</td>
<td>●</td>
<td>●</td>
</tr>
<tr>
<th>string types</th>
Expand All @@ -3118,24 +3123,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 @@ -3148,6 +3168,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 @@ -3160,6 +3181,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 @@ -3172,6 +3194,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 @@ -4910,6 +4933,7 @@ type.
identifier Null
"sequence" "&lt;" TypeWithExtendedAttributes "&gt;" Null
"object" Null
"symbol" Null
"Error" Null
"DOMException" Null
BufferRelatedType Null
Expand Down Expand Up @@ -5327,6 +5351,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 @@ -6356,6 +6389,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 @@ -6875,6 +6911,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