From 667d31487932d6ef1f5c9caa52f4e20f04aa80cb Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Wed, 2 Dec 2020 15:59:08 -0500 Subject: [PATCH] Editorial: Remove ToNumber's note re surrogates (#1554) The note says that "the result of ToNumber will be *NaN* if the string contains any [surrogate] code units, whether paired or unpaired." However, if Unicode were to define a non-BMP code point with General_Category=Zs, that would qualify as and thus WhiteSpace and StrWhiteSpaceChar, in which case the note would be rendered false. That is, the ToNumber procedure would continue to work, and would result in non-NaN values for some strings containing surrogates. (And if you think that the ES spec doesn't need to concern itself with such future possibilities, note that ES 6 (2015) changed/clarified the semantics of String.p.trim et al for precisely this case, to say how they would deal with non-BMP white space.) Given that the note could be invalidated by a future edition of Unicode, I think it's a bit risky to keep it in. --- spec.html | 3 --- 1 file changed, 3 deletions(-) diff --git a/spec.html b/spec.html index a7388cd7969..ddba6ec13a3 100644 --- a/spec.html +++ b/spec.html @@ -4432,9 +4432,6 @@

ToNumber ( _argument_ )

ToNumber Applied to the String Type

ToNumber applied to Strings applies the following grammar to the input String interpreted as a sequence of UTF-16 encoded code points (). If the grammar cannot interpret the String as an expansion of |StringNumericLiteral|, then the result of ToNumber is *NaN*.

- -

The terminal symbols of this grammar are all composed of characters in the Unicode Basic Multilingual Plane (BMP). Therefore, the result of ToNumber will be *NaN* if the string contains any or code units, whether paired or unpaired.

-

Syntax

StringNumericLiteral :::