Cameron McCormack: > > A valueOf method on an object allows it to be converted into a primitive > > when used with particular operators: Jonathan Watt: > Wouldn't it always be the case, not just for particular operators? If not, when > would rect.x evaluate to a Number, and when would it evaluate to an > SVGAnimatedLength? In particular, unary ! won’t invoke valueOf on the object. It just evaluates to true for any object. Even more troublesome would be == and !=. If you had rect.x and rect.y both be SVGAnimatedLengths whose values were 10, then rect.x == rect.y will evaluate to false, since == will check for object identity. You’d need to do rect.x == +rect.y or something instead. I’m beginning to think that there are too many exceptions and that this will confuse authors. -- Cameron McCormack ≝ http://mcc.id.au/Received on Friday, 24 July 2009 00:09:51 GMT
This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 24 July 2009 00:09:55 GMT