Lea Verou on Nostr: 🧨 Unpopular opinion: try {} should have been designed not to behave like a regular ...
🧨 Unpopular opinion: try {} should have been designed not to behave like a regular block wrt block scoping variables.
It’s rarely if ever useful, since its scoping is not conceptually meaningful. Effectively, it’s more of a code annotation than control flow. Unlike control flow blocks, there is no program state that only makes sense within a try {} block.
The catch () {} block on the other hand _is_ actual control flow, and scoping makes complete sense there.
It’s rarely if ever useful, since its scoping is not conceptually meaningful. Effectively, it’s more of a code annotation than control flow. Unlike control flow blocks, there is no program state that only makes sense within a try {} block.
The catch () {} block on the other hand _is_ actual control flow, and scoping makes complete sense there.