W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2015

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

From: Boris Zbarsky <bzbarsky@mit.edu>
Date: Tue, 24 Mar 2015 16:37:06 -0400
Message-ID: <5511CAF2.8030304@mit.edu>
To: whatwg@lists.whatwg.org
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).

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

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:29 UTC