Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is "Object"?)

Mark S. Miller erights at google.com
Wed Oct 3 13:12:51 PDT 2012


On Tue, Oct 2, 2012 at 9:05 PM, Norbert Lindenberg <
ecmascript at norbertlindenberg.com> wrote:

> TC 39, I need decisions so that I can finish the Internationalization spec
> and send it to the Ecma GA:
>
> 1) Instances of Intl.Collator, Intl.NumberFormat, and Intl.DateTimeFormat
> currently have [[Class]] "Object". Should this change to "Collator",
> "NumberFormat", and "DateTimeFormat", respectively?
>
> 2) If the answer to 1) is "yes": The prototype objects of Intl.Collator,
> Intl.NumberFormat, and Intl.DateTimeFormat currently have [[Class]]
> "Object". Should this change to "Collator", "NumberFormat", and
> "DateTimeFormat", respectively?
>
> 3) If the answer to 1) or 2) is "no": The prototype objects of
> Intl.Collator, Intl.NumberFormat, and Intl.DateTimeFormat currently have
> all the state that allows them to be used as instances. Should they not
> have that state, and instead be plain objects with methods?
>
> If I don't get votes from at least 10 of the usual TC 39 attendees within
> the next 24 hours, and a clear majority for change, the spec will remain as
> approved at the meeting two weeks ago.
>

#1 no
#2 no
#3 yes. They should be plain objects with methods but no instance state.
This makes them better resemble classes.


>
> Thanks,
> Norbert
>
>
> On Sep 29, 2012, at 23:08 , Brendan Eich wrote:
>
> > Norbert Lindenberg wrote:
> >> Last week TC 39 approved a standard defining three new built-in
> constructors whose instances and prototype objects all have [[Class]]
> "Object". Also, the prototype objects are not constructed by their
> respective constructors, but initialized by them, e.g., as
> Intl.Collator.call({}).
> >>
> >> Are you suggesting they should have "Collator", "NumberFormat", and
> "DateTimeFormat", respectively, and the prototypes be specified as being
> constructed by their constructors?
> >
> > All else equal, yes (sorry for not flagging these).
> >
> > Any non-equal elses in sight?
> >
> > /be
>
>


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


More information about the es-discuss mailing list