[[Class]] and host objects

Mark Miller erights at gmail.com
Tue Feb 10 16:26:57 PST 2009


On Tue, Feb 10, 2009 at 2:49 PM, Allen Wirfs-Brock <
Allen.Wirfs-Brock at microsoft.com> wrote:

> I guess it is time for one of my alternative lists.


Good. Thanks!



>  The original question was what if any restrictions should ES3.1 place upon
> host objects' [[Class]] values.  The alternatives on the table are:
>
> 1) An implementation can give any host object any [[Class]] value it wants,
> including value that have specified meanings within the spec.  This is what
> ES3 says.
> 2) An implementation may not use any of the specified [[Class]] values for
> a host object.
> 2a) An implementation may only use the specified [[Class]] values for a
> host object that is a fully conforming implement of a Section 15 object.
>  (in which case, it is probably really a native object and not a host object
> at all).
> 3) An implementation may only use the specified [[Class]] values for host
> objects that conform to some specified set of invariants that ES3.1
> specifies for each such [[Class]] value.
>
> #1 is what we have now with ES3 and at least some of us want to tighten the
> specification because it currently means when in the presence of host
> objects that testing [[Class]] guarantees nothing.
>
> #2 seem nice and simple to me but may not be a good fit with existing
> implementations and probably requires rethinking of [[Class]]=="Function"
> predicates in the Function.prototype.bind algorithm.
> #2a ultimately seem the same as #2
>
> #3 would be fine but requires work. We would need to  decide on the
> invariants for  specified [[Class]] value.


Yes, I am in favor of #2.



>
> (parting shot, if [[Class]] was really called [[ToStringIdentifier]] would
> we even be having this conversation?)
>
>
Yes, but we may have then made the (IMO) mistake of introducing a new
internal unforgeable nominal type property, such as your earlier
[[IsArray]], but applicable as well to at least Date, RegExp, and Function,
without noticing the unfortunate redundancy with the existing unforgeable
[[ToStringIdentifier]] property.


-- 
Text by me above is hereby placed in the public domain

   Cheers,
   --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20090210/a6f53ae3/attachment.html>


More information about the Es-discuss mailing list