From b97fabb1758e6feb8f39fb7eb651f839dbd045c1 Mon Sep 17 00:00:00 2001 From: Dan Ehrenberg Date: Thu, 24 Mar 2016 20:29:07 -0700 Subject: [PATCH 1/2] ECMA-402 v1 legacy constructor semantics compromise for NumberFormat This patch addresses #57 by allowing certain legacy constructor patterns to coexist with the new guarantees in ECMA-402 v2, which allows for a pattern where all internal slots exist from the beginning of the object's lifetime. The compromise is based on storing a "real" object inside of a symbol-named property to allow for object initialization in cases of the Intl..call(Object.create(Intl.) pattern. Legacy methods have to forward their calls to this "real" object. This patch specifies the change for Intl.NumberFormat, and a follow-on patch makes the same change for Intl.DateTimeFormat. This patch, together with changes for Intl.DateTimeFormat, has been demonstrated to fix old versions of Intl.js on a deployed website. A sample implementation in V8 can be found at https://codereview.chromium.org/1828543007 --- spec/conventions.html | 4 ++++ spec/index.html | 14 ++++++++++++++ spec/intl.html | 4 ++++ spec/numberformat.html | 37 ++++++++++++++++++++++++++++++++++--- 4 files changed, 56 insertions(+), 3 deletions(-) diff --git a/spec/conventions.html b/spec/conventions.html index 787dd319..6420561b 100644 --- a/spec/conventions.html +++ b/spec/conventions.html @@ -24,6 +24,10 @@

Notational Conventions

For ECMAScript objects, this standard may use variable-named internal slots: The notation "[[<_name_>]]" denotes an internal slot whose name is given by the variable name, which must have a String value. For example, if a variable _s_ has the value *"a"*, then [[<_s_>]] denotes the [[<_a_>]] internal slot.

+

+ This specification uses blocks demarcated as Normative Optional to denote the sense of Annex B in ECMA 262. That is, normative optional sections are required when the ECMAScript host is a web browser. The content of the section is normative but optional if the ECMAScript host is not a web browser. +

+

Well-Known Intrinsic Objects

diff --git a/spec/index.html b/spec/index.html index 9dd67989..09219f00 100644 --- a/spec/index.html +++ b/spec/index.html @@ -25,6 +25,20 @@ margin-bottom: 10px; padding-left: 10px; } + +emu-normative-optional { + margin: 1em 0; + border-left: 5px solid #ff6600; + display: block; + background: #ffeedd; +} + +span.normative-optional { + padding-left: 5px; + text-transform: uppercase; + color: #884400; +} +