RE: IDL: number types

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