Re:Feature request for JavaScript: omit catch
by calkuta on Saturday April 17, 2021 @07:00AM
(#26843287)
Errors are silently suppressed, equivalent to
try {
} catch (err) { }
Re:Feature request for JavaScript: omit catch
by zzo38computer on Saturday April 17, 2021 @01:58PM
(#26846136)
This is contrary to what normally happens when you have try/finally without catch; in that case, it is rethrown automatically. That would be confusing if it was different, I think, and worthless if it was the same (being doing nothing).
Re:Feature request for JavaScript: omit catch
by dragonwriter on Saturday April 17, 2021 @02:44PM
(#26846438)
Since
try {
...
} catch(err) {}
does that, is clear and explicit, and doesn’t make no-catch mean something different than it does in try {
...
} finally {
...
}
I think “no 'catch' as empty 'catch' when there is no 'finally'” is just unnecessary inconsistency for no meaningful gain.
(There are other features I wanted in JavaScript too, though, such as getting rid of automatic semicolon insertion, and adding a "goto" command, and adding macros (these three things can all be implemented using a preprocessor, so even if they are not a part of JavaScript, they can still be used). There are also some things that can't easily or efficiently be added other than adding into JavaScript directly, such as new functions for integers such as popcount and ctz and Date.bigNow() and the MOR and MXOR of MMIX. Some things they have already added that I have wanted, such as integers and byte arrays; I am glad that they added those things.)