W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2012

Re: Should Exceptions be Errors in the ECMAScript bindings?

From: Allen Wirfs-Brock <allen@wirfs-brock.com>
Date: Fri, 22 Jun 2012 08:51:16 -0700
Cc: Travis Leithead <Travis.Leithead@microsoft.com>, Erik Arvidsson <arv@chromium.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-Id: <24CA55A5-79AD-4A0A-8993-0C2B05873BC6@wirfs-brock.com>
To: Cameron McCormack <cam@mcc.id.au>

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

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:06 UTC