What is Nostr?
Lea Verou /
npub1m6e…yan3
2024-08-02 14:36:26

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.
Author Public Key
npub1m6e8q4lxpwxhjcczsjfsnf79g24pcuvppzlysycgdh40jyualamqapyan3