Re: Should Exceptions be Errors in the ECMAScript bindings?

On Jun 21, 2012, at 11:51 PM, Cameron McCormack wrote:

> Cameron McCormack:
>> What would be required to make exception objects be true Error objects?
>>  Is it sufficient to have Web IDL just say that they have [[Class]]
>> "Error"?  Do Error objects have any standardised behaviour that you
>> wouldn't get from just using prototype inheritance as Web IDL currently
>> does?
> 
> There is also the fact that ({}).toString.call(aDOMException) needs to return "[object DOMException]".
> 

ES6 is eliminating [[Class]] in order to make it clear that it is not intended as a poor man's extensible nominal type tag.   In ES6,  {}.toString currently does support open ended parameterization. If you want to modify toString behavior for some family of object, you need to define your own toString methods.

Given this direction, it probably isn't a good idea for WebIDL to be trying to standardize [[Class]] values and their usage as type tags.

Allen

Received on Friday, 22 June 2012 15:51:53 UTC