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

Re: IDL: number types

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 20 Mar 2013 13:34:03 -0400
Message-ID: <5149F30B.7050100@mit.edu>
To: Domenic Denicola <domenic@domenicdenicola.com>
CC: Anne van Kesteren <annevk@annevk.nl>, Marcos Caceres <w3c@marcosc.com>, Yehuda Katz <wycats@gmail.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>
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.

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:08 UTC