« Bugzilla Issues Index

#334 — Why the Intl object cannot have non-constructor properties?

Section 8.1 starts with "Each of the properties of the Intl object is a constructor."

We are considering how private extensions to the i18n functionality may be implemented in a standard way. For new functionality (say, a break iterator), we can simply add a new constructor named something like Intl.v8BreakIterator, but we are struggling to figure out how to implement things like version numbers.

Let's say we want to provide a way to the user to know the version of our API and the version of ICU used in the browser build. We cannot simply have a normal readable but not writable property in the Intl object for that. We would need to make a constructor called something like Intl.v8GetVersions that people are supposed to 'new', and then get another object that they could investigate for the version info.

Why is there such a limitation on Intl's properties?

I meant this sentence as a description of the standard properties, not as a restriction on implementation dependent additional properties. It's similar in that respect to the specification of the JSON object in Ecma-262, which starts with "The JSON object is a single object that contains two functions, parse and stringify...", but of course the Conformance clause of the standard allows additional properties.

Allen, what do you think - do we need to edit all such descriptions to clarify that they only describe the standard properties, or is the Conformance clause sufficient to let implementers add other properties of any type?

Changed to "The value of each of the standard built-in properties of the Intl object is a constructor."