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.

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:06 UTC