Re: [webidl] DOMString

On Tue, 21 Apr 2009 10:55:09 +0200, Oliver Hunt <oliver@apple.com> wrote:
> On Apr 21, 2009, at 1:38 AM, Anne van Kesteren wrote:
>> obj  = { toString:function() { throw("haha") } }
>> obj2 = { toString:function() { return 1 } }
>> obj3 = { toString:function() { return obj } }
>
> The [[ToString]] algorithm is defined in ECMAScript (Section 9.8, [1]),  
> the specified behaviour would result in [[ToString]] on obj2 producing  
> the string "1";  [[ToString]] on obj3 will result in a TypeError, as  
> [[DefaultValue]] will produce a non-primitive type (Section 9.1, [1])
>
> I would assume that the exception will be propagated to the runtime, but  
> it should be stated.
>
> [1] ECMA262-5 RC  
> http://www.ecma-international.org/publications/files/drafts/tc39-2009-025.pdf

Ok, that makes sense. This should also be clarified everywhere ToBoolean,  
ToNumber, ToUint16, and ToInt32 are invoked. (Plus anything I've missed  
:-))


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Tuesday, 21 April 2009 11:30:12 UTC