No subject


Sun Jul 4 11:13:41 PDT 2010


an inference from [[Class]]; if [[Class]] is x then [action]. However,
from a programmer's perspective, `Object.prototype.toString.call(x)`
cannot discriminate between objects originating in the host
environment (what is currently defined as "host object") and native
objects. Mostly they shouldn't care, but should follow the
specification approach to derive [[Class]] based inference, however
they can't follow that because that is not compatible with existing
implementations (notably IE versions and Opera (which copied IE)), and
making an "isStrict" supported global flag is not going to provide a
closely related inference about various types of host objects across a
wide range of implementations in the wild.

Internet Explorer 9 host objects seem to be absent of problems seen in
previous versions of IE but there are still host objects that are
callable, have [[Class]] "Object", and are not implemented with native
semantics. Two examples of such object are alert and addEventListener.

>
>
>>
>> Because that allows `alert` to be any native ECMAScript object
>> (Function, Object, etc), while still letting it be defined as a host
>> object and not violating that spec.
>
>
>
> "that spec"? What specification demands that alert be a host object? I ha=
ve
I cited 4.3.8; the definition of host object.

> not heard of any. This might be a consequence of the upcoming WebIDL-to-E=
S5
> language bindings, but I have seen no draft and so have no idea. My own
> preference would be for these language bindings to result in alert being =
a
> native Function, but that's an argument for a different standards committ=
ee
> ;).
>
> If an implementation's alert is a Function, then it is a native object an=
d
> its [[Class]] must be "Function". It can still be an object provided by a
> host environment whose [[Call]] behavior is written in C++. This simply
> makes it a host provided native built-in object (4.3.7), not a host objec=
t.
>
No, alert is not a defined by ECMAScript specification. It is
therefore host object, by definition of "host object" in ES5, s 4.3.8.

>
>
>
>> Iff, however, following my
>> proposed amendment, `alert` had [[Class]] "Object", and it was not a
>> native ES object (as in IE versions), then it would be a specification
>> violation.
>>
>> > But it is also used from JS. Host objects are exempt from most of the
>> > specific behaviors specified for specific kinds of native objects. Wer=
e
>> > a
>> > host object to be able to allege to be a kind of native object without
>> > behaving as that kind of native object behaves, that would be bad.
>> >
>>
>> This is not in the spec:
>> "without behaving as that kind of native object behaves"
>>
>
> See 4.3.6.
>
That is where native object is defined.

>
>>
>> While the specification does not preclude the possibility that a host
>> object may be implemented with native semantics, it nonetheless
>> defines a host object:
>>
>> | 4.3.8
>> |  host object
>> |  object supplied by the host environment to complete the
>> |  execution environment of ECMAScript.
>> |
>> |  NOTE Any object that is not native is a host object.
>>
>> And that means that `alert`, `window`, `document`, XMLHttpRequest, are
>> all host objects. Whether or not those objects are implemented as
>> native ECMAScript objects is another matter altogether.
>>
>
> This is the crux. The language there is indeed poorly phrased. But native
> objects are not host objects.
>
Where is that stated anywhere in the specification?

> Indeed, it is so poorly phrased that perhaps we should add an errata to
> clean this up. Sigh. cc'ing es5-discuss.
>
>
>>
>> It seems the the spec is wrong and that you have misinterpreted it. I
>> believe that instead it should be written:
>>
>>
> Text missing?
Yes, as I wrote before:

|  The value of the [[Class]] internal property of any non-native host
|  object must be any String value except one of..
The other possibility is that you have misinterpreted the definition
of host object to mean something along the lines of "any object that
is not a native object".

And going by that, referring to the example, `alert` could be a native
object and would then not be a host object.

[...]

>> > (alert instanceof Function) is not a reliable test in either direction=
.
>>
>> No of course not.
>>
>> A
>> > host object as well as a native non-function is perfectly free to
>> > inherit
>> > from Function.prototype and thus pass this test. And an actual functio=
n
>> may
>> > be an instance of Function constructor from another frame and so fail
>> > the
>> > test. But yes, iff alert is indeed a native function, it's [[Class]]
>> should
>> > be "Function".
>> >
>>
>> Therein lies a contradiction: A host object here may be a function.
>>
>
> No it may not. A host object may be callable and it may inherit from
> Function.prototype, but it may not be a function.
>
Once again, ES5 does not preclude the possibility that a host object
may be implemented with native semantics.

>
>> Yet because it is a host object, that same object's [[Class]] must not
>> be "Function", and yet again, since it is a function, and any function
>> must have [[Class]] "Function", then this object's [[Class]] must be
>> "Function".
>>
>> >
>> >
>> >>
>> >> However according to ES5 specs, any host object must not be withing
>> >
>> > the set of values that are not allowable and so the assertion could be
>> >> made that if any object has a [[Class]] that is one of those values,
>> >> then the object is not a host object.
>> >
>> >
>> > Yes, that is intentional.
>>
>> Then it will fail today, as
>>
>> javascript: alert(({}).toString.call(alert))
>>
>> - will result "[object Object]" or "[object Function]"
>>
>
> 1) No current implementations claim ES5 conformance.
> 2) On ES5 conformant implementations, alert may well be a function in whi=
ch
> case the second result will remain correct.
The only way that could be anything other than a contradiction is if
you have redefined "host object" to be as I suggested above (I'll
repeat that one more time).

`alert` is a host object by definition of host object in s. 4.3.8. It
seems as if you have misinterpreted that definition as: "any object
that is not a native object". Is that how you read it?

That is a significantly different definition than either definition in
Eds 3 or 5.

Ed 3:

|   A host object is any object supplied by the host
|  environment to complete the execution environment of
|  ECMAScript. Any object that is not native is a host object.

Ed 5:
|  object supplied by the host environment to complete
|  the execution environment of ECMAScript.
|
|  NOTE Any object that is not native is a host object.
Perhaps this is a case of denying the antecedent?
1. if (not native) then host object.
2. alert is native,
therefore, alert is not host object. (false conclusion)

<http://en.wikipedia.org/wiki/Denying_the_antecedent>

If the definition of host object is correct then the clause that
mentions "[[Class]]" property must change as I initially suggested.
However, if what appears to be your definition of host object was also
what was intended by the editor, then that definition should be
rewritten instead.

If a host object is defined as being any object supplied by the host
environment that is not a native object, then the spec should state
so. If, however, a host object may be a native object -- and that is
how it is currently defined, then for any host object that is not a
native object, that object's [[Class]] property must not be in the set
of class values for native types.

Garrett



--
    Cheers,
    --MarkM



--
    Cheers,
    --MarkM

--_000_90EDC335A511F2479C63F7337D3CE7DB51179782TK5EX14MBXC116r_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3D"Generator" content=3D"Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
	{mso-style-priority:99;
	mso-style-link:"Balloon Text Char";
	margin:0in;
	margin-bottom:.0001pt;
	font-size:8.0pt;
	font-family:"Tahoma","sans-serif";}
span.EmailStyle17
	{mso-style-type:personal-reply;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
span.BalloonTextChar
	{mso-style-name:"Balloon Text Char";
	mso-style-priority:99;
	mso-style-link:"Balloon Text";
	font-family:"Tahoma","sans-serif";}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri","sans-serif";}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"EN-US" link=3D"blue" vlink=3D"purple">
<div class=3D"WordSection1">
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">&gt;&gt;</span> The more =
important issue is our intent regarding the definitions of &quot;host&quot;=
 and &quot;native&quot; objects.<span style=3D"font-size:11.0pt;font-family=
:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p></o:p></spa=
n></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">First regarding, alert in=
 IE.&nbsp; Historically it is what it is and nobody should make any assumpt=
ions concerning the future based upon previous versions of IE
 or what they have observed so for in IE9 preview builds.&nbsp; I don&#8217=
;t think there is any disagreement that the [[class]] of alert should be &#=
8216;Function&#8217;. However, if you want to pin that down in a standard t=
hen WebIDL is probably the place you need to do it.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">I agree that there is sti=
ll a lack of clarity in the ES5 spec. regarding the definition of &#8220;ho=
st object&#8221; and the distinction between &#8220;host&#8221; and &#8220;=
native&#8221; objects.&nbsp;
 The ES5 spec. is better than the previous editions in this regard but coul=
d still be improved.&nbsp; This isn&#8217;t an error that can be corrected =
by an errata but it is something that can be improved by rewrites in future=
 editions. In particular, the spec. is fuzzy
 about whether the sets of native and host objects are disjoint.<o:p></o:p>=
</span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">Here is what I believe is=
 the intent:<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">Native Object: as stated =
in 4.3.6, an object that fully implements the object semantics defined by t=
he Ecma-262 specification. Such objects might be built-in,
 user defined using ECMAScript code, or provided by the host &nbsp;(and tha=
t presumably includes libraries of native objects that are accessed via hos=
t defined facilities). &nbsp;The important point and the characteristic tha=
t makes then &#8220;native&#8221; is that they fully conform
 to the standards semantics for objects.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">Host object: as stated in=
 4.3.8, an object supplied by the host environment.&nbsp; If a host object =
fully implements the standard object semantics then it is also
 a native object (hence native and host objects are not two disjoint sets).=
&nbsp; However, host objects are not required to implement this standard se=
mantics.&nbsp; In addition, the note to 4.3.8 says that any object that isn=
&#8217;t native (ie, doesn&#8217;t implement standard
 object semantics) is a host object.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">So essentially, they are =
two kinds of host objects: native host objects and non-native host objects.=
&nbsp; The spec. doesn&#8217;t explicitly talk about native host objects
 because their hostness is semantically irrelevant if they are also native.=
 &nbsp;Hence, when the spec. talks about &#8220;host objects&#8221; in most=
 cases it is really talking about non-native host objects in order to impos=
e specific sematic constraints upon them. &nbsp;I believe
 that in most cases in the ES5 spec, &nbsp;&#8220;host object&#8221; should=
 be read as meaning &#8220;non-native host object&#8221;.<o:p></o:p></span>=
</p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">By these terms, an &nbsp;=
Array instance (or other built-in object &#8220;class&#8221; instance) can =
be a host object but if it is, it must be a native host object. That is,
 it most fully implement the specific semantics for that kind of object. <o=
:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">Allen<o:p></o:p></span></=
p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span><=
/p>
<div style=3D"border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in =
4.0pt">
<div>
<div style=3D"border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in =
0in 0in">
<p class=3D"MsoNormal"><b><span style=3D"font-size:10.0pt;font-family:&quot=
;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style=3D"font-s=
ize:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> Mark S. =
Miller [mailto:erights at google.com]
<br>
<b>Sent:</b> Sunday, July 18, 2010 9:52 AM<br>
<b>To:</b> Allen Wirfs-Brock<br>
<b>Cc:</b> Garrett Smith; es5-discuss at mozilla.org; es-discuss<br>
<b>Subject:</b> Re: [[Class]] Property of Host Object<o:p></o:p></span></p>
</div>
</div>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Hi Allen, that answers the &quot;must is be a String=
?&quot; issue, thanks.<o:p></o:p></p>
<div>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class=3D"MsoNormal" style=3D"margin-bottom:12.0pt">The more important is=
sue is our intent regarding the definitions of &quot;host&quot; and &quot;n=
ative&quot; objects. What is your memory of this issue? How well do you thi=
nk the spec reflects this intent?<o:p></o:p></p>
<div>
<p class=3D"MsoNormal">On Sun, Jul 18, 2010 at 7:31 AM, Allen Wirfs-Brock &=
lt;<a href=3D"mailto:Allen.Wirfs-Brock at microsoft.com">Allen.Wirfs-Brock at mic=
rosoft.com</a>&gt; wrote:<o:p></o:p></p>
<div>
<div>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto"><span style=3D"font-size:11.0pt;color:#1F497D">Table 8, section 8.=
6.2</span><o:p></o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto"><span style=3D"font-size:11.0pt;color:#1F497D">Internal Property: =
[[Class]]</span><o:p></o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto"><span style=3D"font-size:11.0pt;color:#1F497D">Value Type Domain: =
String</span><o:p></o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto"><span style=3D"font-size:11.0pt;color:#1F497D">Description: A Stri=
ng value indicating a specification defined classification of objects</span=
><o:p></o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto"><span style=3D"font-size:11.0pt;color:#1F497D">&nbsp;</span><o:p><=
/o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto"><span style=3D"font-size:11.0pt;color:#1F497D">Allen</span><o:p></=
o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto"><span style=3D"font-size:11.0pt;color:#1F497D">&nbsp;</span><o:p><=
/o:p></p>
<div style=3D"border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in =
4.0pt">
<div>
<div style=3D"border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in =
0in 0in">
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto"><b><span style=3D"font-size:10.0pt">From:</span></b><span style=3D=
"font-size:10.0pt">
<a href=3D"mailto:es-discuss-bounces at mozilla.org" target=3D"_blank">es-disc=
uss-bounces at mozilla.org</a> [mailto:<a href=3D"mailto:es-discuss-bounces at mo=
zilla.org" target=3D"_blank">es-discuss-bounces at mozilla.org</a>]
<b>On Behalf Of </b>Mark S. Miller<br>
<b>Sent:</b> Saturday, July 17, 2010 12:54 PM<br>
<b>To:</b> Garrett Smith<br>
<b>Cc:</b> <a href=3D"mailto:es5-discuss at mozilla.org" target=3D"_blank">es5=
-discuss at mozilla.org</a>; es-discuss<br>
<b>Subject:</b> Re: [[Class]] Property of Host Object</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto">&nbsp;<o:p></o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto">In short, I largely agree with you about the language in the ES5 s=
pec text. My interpretation of that text derives in large part from my memo=
ries of the conversations that led up
 to it, and my sense of the intent we were trying to capture. In the absenc=
e of that context, I would probably arrive at the same reading of ES5 that =
you have.<o:p></o:p></p>
<div>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto">&nbsp;<o:p></o:p></p>
</div>
<div>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto">At this point, I will wait until others who participated in those =
conversations weigh in and state their sense of our agreed intent. Once we =
understand what agreed intent there
 actually was, we can proceed from there.&nbsp;<o:p></o:p></p>
<div>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;margin-bottom:12.0p=
t">&nbsp;<o:p></o:p></p>
<div>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto">On Sat, Jul 17, 2010 at 12:17 PM, Garrett Smith &lt;<a href=3D"mai=
lto:dhtmlkitchen at gmail.com" target=3D"_blank">dhtmlkitchen at gmail.com</a>&gt=
; wrote:<o:p></o:p></p>
<div>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;margin-bottom:12.0p=
t">On 7/17/10, Mark S. Miller &lt;<a href=3D"mailto:erights at google.com" tar=
get=3D"_blank">erights at google.com</a>&gt; wrote:<br>
&gt; [&#43;es5-discuss as a possible errata issue arises below]<br>
&gt;<br>
&gt;<br>
&gt; On Sat, Jul 17, 2010 at 12:37 AM, Garrett Smith<br>
&gt; &lt;<a href=3D"mailto:dhtmlkitchen at gmail.com" target=3D"_blank">dhtmlk=
itchen at gmail.com</a>&gt;wrote:<br>
&gt;<br>
&gt;&gt; On 7/16/10, Mark S. Miller &lt;<a href=3D"mailto:erights at google.co=
m" target=3D"_blank">erights at google.com</a>&gt; wrote:<br>
&gt;&gt; &gt; On Fri, Jul 16, 2010 at 9:54 PM, Garrett Smith<br>
&gt;&gt; &gt; &lt;<a href=3D"mailto:dhtmlkitchen at gmail.com" target=3D"_blan=
k">dhtmlkitchen at gmail.com</a>&gt;wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; I have a question reqarding [[Class]] property as defined=
 In ES5:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; | The value of the [[Class]] internal property of a host =
object<br>
&gt;&gt; &gt;&gt; | may be any String value except one of &quot;Arguments&q=
uot;, &quot;Array&quot;,<br>
&gt;&gt; &gt;&gt; | &quot;Boolean&quot;, &quot;Date&quot;, &quot;Error&quot=
;, &quot;Function&quot;, &quot;JSON&quot;, &quot;Math&quot;, &quot;Number&q=
uot;,<br>
&gt;&gt; &gt;&gt; | &quot;Object&quot;, &quot;RegExp&quot;, and &quot;Strin=
g&quot;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; May it be something other than a string value? Or must it=
 be a string<br>
&gt;&gt; &gt;&gt; value?<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; It must be a string value.<br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt; The specification says &quot;may&quot;.<br>
&gt;&gt;<br>
&gt;<br>
&gt; Ah. I see the ambiguity. &quot;may&quot; there is modifying &quot;any&=
quot;. It should probably<br>
&gt; have been stated:<br>
&gt;<br>
&gt; &nbsp; &nbsp; ...must be a String value and may be any String value ex=
cept...<br>
&gt;<br>
&gt; In reviewing the document, the possibility that text would allow non-S=
tring<br>
&gt; [[Class]]es had not occurred to me. Now that you point it out, and can=
 see<br>
&gt; some reasons why we might want to leave the current text alone and all=
ow<br>
&gt; non-String [[Class]]es.<br>
&gt;<o:p></o:p></p>
</div>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto">I don't.<br>
<br>
[[Class]] must be a string value. If the [[Class]] property is absent,<br>
what happens when the object is supplied to Object.prototype.toString?<br>
TypeError. Why not avoid that possibility and require host object to<br>
have [[Class]] be a string value?<o:p></o:p></p>
<div>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;margin-bottom:12.0p=
t"><br>
&gt;<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Why must a host object's class be none of the built-in cl=
asses listed?<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; So that the [[Class]] property serve as a reliable nominal ty=
pe check<br>
&gt;&gt; &gt; for<br>
&gt;&gt; &gt; the contract that the other internal properties and methods s=
atisfy.<br>
&gt;&gt; &gt; This<br>
&gt;&gt; is<br>
&gt;&gt; &gt; used primarily within the spec itself. Previously, it wasn't =
clear what<br>
&gt;&gt; was<br>
&gt;&gt; &gt; meant when the spec said, for example, &quot;if F is a functi=
on&quot;. Now we<br>
&gt;&gt; clearly<br>
&gt;&gt; &gt; say &quot;if the [[Class]] of F is 'Function' &quot; if that'=
s what we mean.<br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt; I think I see the problem.<br>
&gt;&gt;<br>
&gt;&gt; What you really want to say there is:<br>
&gt;&gt;<br>
&gt;&gt; | &nbsp;The value of the [[Class]] internal property of any non-na=
tive host<br>
&gt;&gt; | &nbsp;object must be any String value except one of...<br>
&gt;&gt;<br>
&gt;<br>
&gt; Saying &quot;non-native&quot; and &quot;host&quot; together is redunda=
nt. Although the language<br>
&gt; of 4.3.6 and 4.3.8 is not as clear as it should be, I read these as st=
ating<br>
&gt; that all EcmaScript objects are either host or native. No object can b=
e both<br>
&gt; host and native. And no object can be neither host nor native.<br>
&gt;<o:p></o:p></p>
</div>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto">It is not redundant. Repeating what was written in my last message=
:<o:p></o:p></p>
<div>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;margin-bottom:12.0p=
t"><br>
| &nbsp;While the specification does not preclude the possibility that a ho=
st<br>
| &nbsp;object may be implemented with native semantics, it nonetheless<br>
| &nbsp;defines a host object:<o:p></o:p></p>
</div>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto">I understand that the values for [[Class]] are used internally by =
the<br>
specification. One example of that is Array.isArray(x), where the<br>
[[Class]] property is used internally. Another example is behavior for<br>
`JSON` reviver.<br>
<br>
The specification allows for two types of host objects:<br>
&nbsp;* host objects as native objects<br>
&nbsp;* host objects as not native objects (does not use native semantics)<=
br>
<br>


More information about the es-discuss mailing list