- From: João Eiras <joaoe@opera.com>
- Date: Thu, 19 Nov 2009 23:50:33 +0100
- To: "public-webapps@w3.org" <public-webapps@w3.org>
>> 2) We can define, in the Web IDL, how an object can be converted to a >> primitive type. >> Specifically, in an ecmascript binding we can do the following (note: >> returns means to stop the steps): >> - if object is null, return null >> - if object has a member function called valueOf, invoke valueOf in the >> context of object >> - if the returned value is a primitive type, return the value, >> - if object has a member function called toString, invoke toString in >> the context of object >> - if the returned value is a primitive type, return the value, >> - return Object.prototype.toString.call(object), so we get "[object >> Class]" > > ECMAScript defines a ToPrimitive conversion (Section 9.1 of ECMA-262 5th > edition). I think the right thing to do would be for some spec to point > to those steps. Probably it has to be Web Database, because in many > cases where a Web IDL method takes an "any" type, it's not appropriate > to do ToPrimitive conversion. > Indeed ! -- João Eiras Core Developer, Opera Software ASA, http://www.opera.com/
Received on Thursday, 19 November 2009 22:51:13 UTC