4 ms·
What happens if something is thrown? You can have try without catch if there is a finally block, but with neither catch nor finally, then what? (There are othe
by zzo38computer 6y ago
What happens if something is thrown? You can have try without catch if there is a finally block, but with neither catch nor finally, then what?
(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.)
- calkuta 6y agoErrors are silently suppressed, equivalent to try { } catch (err) { }
- zzo38computer 6y agoThis 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).
- dragonwriter 6y agoSince 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.