Re: [whatwg] Why CanvasRenderingContext2D uses WebIDL unrestricted float type?

On 3/24/15 4:06 PM, Tetsuharu OHZEKI wrote:
> But I think that, why don't  CanvasRenderingContext2D use restricted
> float type defined in WebIDL if these methods ignore the value when
> its is not finite?

Because they want to ignore the value.

> By the current WebIDL spec
> (http://heycam.github.io/webidl/#es-double), restricted values,
> 'float' & 'double', will raise TypeError in conversion phase under
> ECMAScript environment if the passed value is a NaN or +-Infinity.

Exactly.  That's not the same thing as ignoring the value.

> For the purpose to ignore non-restricted values, I feel that it's more
> better to restrict by IDL type.

Not if you want to actually _ignore_ the value (as opposed to throwing 
an exception).

-Boris

Received on Tuesday, 24 March 2015 20:37:32 UTC