W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2013

Re: IDL enumeration & String.prototype.normalize

From: Allen Wirfs-Brock <allen@wirfs-brock.com>
Date: Tue, 6 Aug 2013 08:32:53 -0700
Cc: "public-script-coord@w3.org" <public-script-coord@w3.org>, es-discuss <es-discuss@mozilla.org>
Message-Id: <36923966-66EB-4C12-842E-00D79100809F@wirfs-brock.com>
To: Anne van Kesteren <annevk@annevk.nl>
 On Aug 6, 2013, at 7:59 AM, Anne van Kesteren wrote:

> In IDL not being part of an enumeration throws TypeError. It seems
> String.prototype.normalize uses RangeError. I've no preference as to
> which is better, but it would be good if they were equal.

The argument to String.prototype.noralization is not an enumeration (not an ES concept) but a string.  If the agument can not be converted to a string value, a TypeError is thrown.  If the string value is not within the range of expected values, a RangeError is thrown.  This is all normal ES conventions.

> 
> Also, throughout the platform we typically lowercase enumeration
> constants, e.g. "arraybuffer". I think it would be good for
> String.prototype.normalize to follow that precedent and use "nfc" etc.

The argument values aren't enumeration constants.  They are string values that are the exact the abbreviations used by the Unicode standard to identify normalization forms. 

> 
> (I was a bit surprised to see Unicode normalization exposed here.
> We've been pretty hesitant elsewhere to introduce dependencies on it,
> but I guess at this level it might be okay.)

see http://wiki.ecmascript.org/doku.php?id=strawman:unicode_normalization for the rationale.


Allen


> 
> 
> -- 
> http://annevankesteren.nl/
> 
Received on Tuesday, 6 August 2013 15:33:29 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:50 UTC