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

RE: IDL: number types

From: Domenic Denicola <domenic@domenicdenicola.com>
Date: Wed, 20 Mar 2013 17:41:03 +0000
To: Boris Zbarsky <bzbarsky@MIT.EDU>
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>
Message-ID: <B4AE8F4E86E26C47AC407D49872F6F9F6EFB6128@BY2PRD0510MB354.namprd05.prod.outlook.com>
From: Boris Zbarsky [bzbarsky@MIT.EDU]

> On 3/20/13 12:46 PM, Domenic Denicola wrote:

>> 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.

That was what I was curious about; thanks! So it's this pattern WebIDL is meant to encourage. Essentially it is a declarative way of doing the argument-type coercion you find in the ES spec, e.g. step 5 of http://es5.github.com/#x15.3.4.3

In that case I'd imagine the number types you'd want are Number, Integer, Int32, Uint32, and Uint16. (Although Uint16 is only used for char codes in ES5, so maybe that can be omitted.) I think this matches what you were saying up-thread.

Received on Wednesday, 20 March 2013 17:41:39 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:09 UTC