Perhaps a syntax based on modules:
```js
try {}
catch (TypeError as e) {}
// ...
try {}
catch (MyError as err) {}
```
On Fri, May 13, 2016 at 9:43 AM, Michał Wadas <[email protected]> wrote:
> I can't see why would your syntax be superior to SpiderMonkey extension
> except saving few characters.
>
> Can your syntax support code like this:
>
> async function foo() {
> try {
> throw new Error();
> } catch(e if isNativeException(e)) {
> // special handler for DOM exceptions
> } catch(e if e instanceof (await
> fancyClassLoader.load('classes/SomeLibrary/UserDefinedError'))) {
> // load class asynchronously if it wasn't loaded
> }
> }
>
> ?
>
>
> On Fri, May 13, 2016 at 5:58 PM, Joseph Groseclose <[email protected]>
> wrote:
>>
>> I've updated the proposal. See:
>> https://github.com/benderTheCrime/error-type-specific-catch-proposal#about-spidermonkey-implementation
>>
>> On Fri, May 13, 2016 at 11:49 AM, Joseph Groseclose <[email protected]>
>> wrote:
>>>
>>> Nevertheless, perhaps the non-standard implementation could work
>>> hand-in-hand with the proposal, where SpiderMonkey could support both
>>> solutions in parallel for backward compatibility. I think that the proposed
>>> solution is more expressive.
>>>
>>> On Fri, May 13, 2016 at 11:26 AM, Claude Pache <[email protected]>
>>> wrote:
>>>>
>>>> Note that SpiderMonkey has already nonstandard conditional catch
>>>> clauses:
>>>>
>>>> ```js
>>>> try {
>>>> // ...
>>>> }
>>>> catch (e if e instanceof TypeError) {
>>>> // ....
>>>> }
>>>> ```
>>>>
>>>> —Claude
>>>>
>>>>
>>>> Le 13 mai 2016 à 17:06, Joseph Groseclose <[email protected]> a écrit
>>>> :
>>>>
>>>> I sent this proposal via
>>>> http://www.ecma-international.org/memento/contribute_TC39_Royalty_Free_Task_Group.php#
>>>> yesterday evening. Sharing it here now:
>>>> https://github.com/benderTheCrime/error-type-specific-catch-proposal
>>>>
>>>>
>>>> _______________________________________________
>>>> es-discuss mailing list
>>>> [email protected]
>>>> https://mail.mozilla.org/listinfo/es-discuss
>>>>
>>>>
>>>
>>
>>
>> _______________________________________________
>> es-discuss mailing list
>> [email protected]
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss