- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Thu, 01 Nov 2012 11:56:31 -0400
- To: "public-script-coord@w3.org" <public-script-coord@w3.org>
The spec says in http://dev.w3.org/2006/webapi/WebIDL/#dfn-constant : The type of an integer token is the same as the type of the constant, dictionary member or optional argument it is being used as the value of. The value of the integer token MUST NOT lie outside the valid range of values for its type, as given in section 3.10 below. and in http://dev.w3.org/2006/webapi/WebIDL/#idl-operations : When a boolean literal token (true or false), the null token, an integer token, a float token or one of the three special floating point literal values (Infinity, -Infinity or NaN) is used as the default value, it is interpreted in the same way as for a constant. but on the face of it this is bogus, since this: void foo(optional DOMString something = 5); should presumably not be valid, right? And then this further raises the question of whether: void foo(optional float something = 5); or const float myConst = 5; are valid. I think these _should_ be. So I would propose that we explicitly limit the "same as the type" to "primitive types excluding boolean". Furthermore in the float/double cases I think we should require that the integer be exactly representable. -Boris
Received on Thursday, 1 November 2012 15:57:00 UTC