Re: IDL enumeration String.prototype.normalize

2013-08-06 Thread Allen Wirfs-Brock
 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/
 

___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: IDL enumeration String.prototype.normalize

2013-08-06 Thread Anne van Kesteren
On Tue, Aug 6, 2013 at 4:32 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote:
 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.

An IDL enumeration bottoms-out to that, though. It's just a high-level
concept (as are most IDL things) to enforce some level of consistency
across APIs. That you instead describe it in terms of the low-level
equivalent should not matter much for how we reason about them, unless
I'm missing something.


-- 
http://annevankesteren.nl/
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


RE: IDL enumeration String.prototype.normalize

2013-08-06 Thread Domenic Denicola
Right, I think both are indeed enums at some conceptual level. IDL gives that 
concept a name; ES does not. It would be nice if IDL enums followed ES 
semantics, of doing `ToString(value)` (which may throw a `TypeError`) and then 
throwing a `RangeError` if outside the allowed range.

However, the [definition of `RangeError`][1] probably needs some updating in 
that case:

 Indicates a numeric value has exceeded the allowable range.

[1]: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-15.11.5.2

___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: IDL enumeration String.prototype.normalize

2013-08-06 Thread Rick Waldron
On Tue, Aug 6, 2013 at 11:50 AM, Domenic Denicola 
dome...@domenicdenicola.com wrote:

 Right, I think both are indeed enums at some conceptual level. IDL gives
 that concept a name; ES does not. It would be nice if IDL enums followed ES
 semantics, of doing `ToString(value)` (which may throw a `TypeError`) and
 then throwing a `RangeError` if outside the allowed range.

 However, the [definition of `RangeError`][1] probably needs some updating
 in that case:

  Indicates a numeric value has exceeded the allowable range.


Can you file a bug here:
https://bugs.ecmascript.org/enter_bug.cgi?product=Draft%20for%206th%20Edition

Thanks!

Rick
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: IDL enumeration String.prototype.normalize

2013-08-06 Thread Norbert Lindenberg

On Aug 6, 2013, at 10:24 , Rick Waldron waldron.r...@gmail.com wrote:

 On Tue, Aug 6, 2013 at 11:50 AM, Domenic Denicola 
 dome...@domenicdenicola.com wrote:

 However, the [definition of `RangeError`][1] probably needs some updating in 
 that case:
 
  Indicates a numeric value has exceeded the allowable range.
 
 Can you file a bug here: 
 https://bugs.ecmascript.org/enter_bug.cgi?product=Draft%20for%206th%20Edition

I filed that ticket almost two years ago:
https://bugs.ecmascript.org/show_bug.cgi?id=224

Norbert

___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss