Thanks to both of you, I wasn't aware that this was already documented in an ES6 draft - my apologies.<div><br></div><div>Rick<br><br><div class="gmail_quote">On Fri, Jan 27, 2012 at 1:23 PM, Allen Wirfs-Brock <span dir="ltr"><<a href="mailto:allen@wirfs-brock.com">allen@wirfs-brock.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div class="im"><br><div><div>On Jan 27, 2012, at 9:59 AM, Rick Waldron wrote:</div>
<br>
<blockquote type="cite"><br>On Fri, Jan 27, 2012 at 12:08 PM, Brendan Eich <span dir="ltr"><<a href="mailto:brendan@mozilla.org" target="_blank">brendan@mozilla.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



[[Class]] begone in ES6.<br></blockquote><div><br></div><div>Assuming the public facing API has no intention of breaking back compatibility, what internal property will be read to determine the return value of Object.prototype.toString (15.2.4.2)?</div>



<div><br></div></div></blockquote><br></div></div><div>The current ES6 draft defines its like this:</div><div><br></div><div><br></div><div><p style="margin:3.0px 0px 12.0px 0px;line-height:11.5px;font:10.0px Arial"><b>15.2.4.2<span style="white-space:pre-wrap">      </span>Object.prototype.toString ( )</b></p>

<p style="margin:0px 0px 12.0px 0px;text-align:justify;line-height:11.5px;font:10.0px Arial">When the <span style="font:10.0px 'Courier New'"><b>toString</b></span> method is called, the following steps are taken:</p>


<ol style="list-style-type:decimal">
<li style="margin:0px 0px 0px 0px;font:10.0px 'Times New Roman'"><span style="letter-spacing:0.3px"><span style="white-space:pre-wrap"> </span>If the <b>this</b> value is <b>undefined</b>, return </span><span style="font:10.0px 'Courier New';letter-spacing:0.3px"><b>"[object Undefined]"</b></span><span style="letter-spacing:0.3px">.</span></li>


<li style="margin:0px 0px 0px 0px;font:10.0px 'Times New Roman'"><span style="letter-spacing:0.3px"><span style="white-space:pre-wrap"> </span>If the <b>this</b> value is <b>null</b>, return </span><span style="font:10.0px 'Courier New';letter-spacing:0.3px"><b>"[object Null]"</b></span><span style="letter-spacing:0.3px">.</span></li>


<li style="margin:0px 0px 0px 0px;font:10.0px 'Times New Roman'"><span style="letter-spacing:0.3px"><span style="white-space:pre-wrap"> </span>Let <i>O </i>be the result of calling ToObject passing the <b>this </b>value as the argument.</span></li>


<li style="margin:0px 0px 0px 0px;font:10.0px 'Times New Roman'"><span style="letter-spacing:0.3px"><span style="white-space:pre-wrap"> </span>If <i>O</i> has a [[NativeBrand]] internal property, let <i>tag</i> be the corresponding value from the Table 23.</span></li>


<li style="margin:0px 0px 0px 0px;font:10.0px 'Times New Roman'"><span style="letter-spacing:0.3px"><span style="white-space:pre-wrap"> </span>Else, let <i>tag</i> be the string value </span><span style="font:10.0px 'Courier New';letter-spacing:0.3px"><b>"Object"</b></span><span style="letter-spacing:0.3px">.</span></li>


<li style="margin:0px 0px 11.0px 0px;font:10.0px 'Times New Roman'"><span style="letter-spacing:0.3px"><span style="white-space:pre-wrap">      </span>Return the String value that is the result of concatenating the three Strings </span><span style="font:10.0px 'Courier New';letter-spacing:0.3px"><b>"[object "</b></span><span style="letter-spacing:0.3px">, <i>tag</i>, and </span><span style="font:10.0px 'Courier New';letter-spacing:0.3px"><b>"]"</b></span><span style="letter-spacing:0.3px">.</span></li>


</ol><p style="margin:6.0px 0px 6.0px 0px;text-align:center;line-height:11.5px;font:10.0px Arial"><span style="letter-spacing:0.3px"><b>Table 23 — Tags for Classified Native Objects</b></span></p>
<table width="247.6" cellspacing="0" cellpadding="0" style="width:247.6px;border-collapse:collapse">
<tbody>
<tr>
<td valign="top" style="width:134.8px;background-color:#cbcbcb;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;text-align:center;line-height:11.5px;font:normal normal normal 10px/normal Arial">

<span style="letter-spacing:0.3px"><b>[[NativeBrand]] Value</b></span></div>
</td>
<td valign="top" style="width:112.8px;background-color:#cbcbcb;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;text-align:center;line-height:11.5px;font:normal normal normal 10px/normal Arial">

<span style="letter-spacing:0.3px"><b><i>tag</i> Value</b></span></div>
</td>
</tr>
<tr>
<td valign="top" style="width:134.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal Arial">

<span style="letter-spacing:0.3px">NativeFunction</span></div>
</td>
<td valign="top" style="width:112.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal 'Courier New'">

<span style="letter-spacing:0.3px"><b>"Function"</b></span></div>
</td>
</tr>
<tr>
<td valign="top" style="width:134.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal Arial">

<span style="letter-spacing:0.3px">NativeArray</span></div>
</td>
<td valign="top" style="width:112.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal 'Courier New'">

<span style="letter-spacing:0.3px"><b>"Array"</b></span></div>
</td>
</tr>
<tr>
<td valign="top" style="width:134.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal Arial">

<span style="letter-spacing:0.3px">StringWrapper</span></div>
</td>
<td valign="top" style="width:112.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal 'Courier New'">

<span style="letter-spacing:0.3px"><b>"String"</b></span></div>
</td>
</tr>
<tr>
<td valign="top" style="width:134.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal Arial">

<span style="letter-spacing:0.3px">BooleanWrapper</span></div>
</td>
<td valign="top" style="width:112.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal 'Courier New'">

<span style="letter-spacing:0.3px"><b>"Boolean"</b></span></div>
</td>
</tr>
<tr>
<td valign="top" style="width:134.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal Arial">

<span style="letter-spacing:0.3px">NumberWrapper</span></div>
</td>
<td valign="top" style="width:112.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal 'Courier New'">

<span style="letter-spacing:0.3px"><b>"Number"</b></span></div>
</td>
</tr>
<tr>
<td valign="top" style="width:134.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal Arial">

<span style="letter-spacing:0.3px">NativeMath</span></div>
</td>
<td valign="top" style="width:112.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal 'Courier New'">

<span style="letter-spacing:0.3px"><b>"Math"</b></span></div>
</td>
</tr>
<tr>
<td valign="top" style="width:134.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal Arial">

<span style="letter-spacing:0.3px">NativeDate</span></div>
</td>
<td valign="top" style="width:112.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal 'Courier New'">

<span style="letter-spacing:0.3px"><b>"Date"</b></span></div>
</td>
</tr>
<tr>
<td valign="top" style="width:134.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal Arial">

<span style="letter-spacing:0.3px">NativeRegExp</span></div>
</td>
<td valign="top" style="width:112.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #cbcbcb #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal 'Courier New'">

<span style="letter-spacing:0.3px"><b>"RegExp"</b></span></div>
</td>
</tr>
<tr>
<td valign="top" style="width:134.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal Arial">

<span style="letter-spacing:0.3px">NativeError</span></div>
</td>
<td valign="top" style="width:112.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #cbcbcb #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal 'Courier New'">

<span style="letter-spacing:0.3px"><b>"Error"</b></span></div>
</td>
</tr>
<tr>
<td valign="top" style="width:134.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal Arial">

<span style="letter-spacing:0.3px">NativeJSON</span></div>
</td>
<td valign="top" style="width:112.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #cbcbcb #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal 'Courier New'">

<span style="letter-spacing:0.3px"><b>"JSON"</b></span></div>
</td>
</tr>
<tr>
<td valign="top" style="width:134.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #000000 #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal Arial">

<span style="letter-spacing:0.3px">NativeArguments</span></div>
</td>
<td valign="top" style="width:112.8px;border-style:solid;border-width:1.0px 1.0px 1.0px 1.0px;border-color:#cbcbcb #cbcbcb #cbcbcb #cbcbcb;padding:0px 5.0px 0px 5.0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:11.5px;font:normal normal normal 10px/normal 'Courier New'">

<span style="letter-spacing:0.3px"><b>"Arguments"</b></span></div>
</td>
</tr>
</tbody>
</table></div><br><div><br></div><div>Basically, there is a fixed set of hardwired (to the spec.) object kinds that toString knows about. There is no implication that all objects must carry around an additional string value that is used to parameterize toString. If you want to extend an implementation with new built-in object kinds that toString recognizes then you must also extend your implementation of toString.  </div>

<div><br></div><div>[[Class]] has been treated by some as a mandatory implementation level extension point for adding new internal types, but it wasn't.</div><div><br></div><div>Note that I have considered extending the above definition of toString with an explicit ES level extension point based using private names:</div>

<div><br></div><div>If <i>O</i> has as well known private name property (think of it as: privateToStringTag) then <i>tag</i> is set to ToString of the value of that property.  This would happen between steps 4 and 5.</div>

<span class="HOEnZb"><font color="#888888"><div><br></div><div>Allen</div></font></span></div></blockquote></div><br></div>