Re: IDL: number types

On 3/20/13 12:46 PM, Domenic Denicola wrote:
>> Well, we would still want a distinction between floating point, integer, non-negative integer, floating point without Infinity, -Infinity, or NaN, ...
>
> Why? JavaScript can't distinguish, so why should WebIDL?

JavaScript "distinguishes" all the time, in the sense that it will 
convert its IEEE doubles into integer representations for various things.

Try setting an array length to 10.5.  Or using the bitshift or bitwise 
logical operators in JS.

> Or is the idea that properties specified as non-negative integers should have setters that throw when you set them to negative integers or to floating point numbers?

A property specified as "unsigned long" in IDL takes its input, converts 
it to a JS Number, then applies ToUint32 from the ES spec, then works 
with the result.

Pretty much like array lengths in JS do, say.

-Boris

Received on Wednesday, 20 March 2013 17:34:32 UTC