Globalization API: Prototype objects

Allen Wirfs-Brock allen at
Tue Feb 7 10:42:56 PST 2012

On Feb 7, 2012, at 10:27 AM, Norbert Lindenberg wrote:

> The current specification of the ECMAScript Globalization API requires the prototype objects for the LocaleList, Collator, NumberFormat, and DateTimeFormat constructors to be objects constructed by these constructors themselves.

Actually, the ES5.1 spec. generally  requires such prototype objects to meet all the requirements that apply to instances of the corresponding constructor. How they are actually constructed is a implementation detail.

> This is following a pattern established in the ECMAScript Language Specification, which requires the Date prototype object to be a Date object, the RegExp prototype object to be a RegExp object, etc.
> At the November TC 39 meeting, there were some comments that this is not the recommended pattern anymore. Instead, prototype objects should be minimal objects with just those properties (mostly methods) that all constructed objects should inherit.

That is an opinion upon which I don't think there is actual consensus.

Regardless, I don't think that a supplemental standard such as this would be the right place to make such a change of course.  

> Which way should the Globalization API go?

As a extension to the ES5.1 standard, I think Globalization standard should, as much as possible, for the conventions of ES5.1.  I don't see any harm in following the current pattern.

I do,however, think it is desirable that we try to define new built-in such such that they may reasonably be "sub-classed".  This is something I'm looking at as I the review the current draft and will likely have some specific comments relating to that.


More information about the es-discuss mailing list