3 ms·
s/yet/thankfully/. We don’t need it cause it solves no real problem and the solution is loaded with implicit complexity.
by wruza 2y ago
s/yet/thankfully/. We don’t need it cause it solves no real problem and the solution is loaded with implicit complexity.
- unilynx 2y ago'using' fixes having to do cleanup in a finally {} handler, which you can a) forget, and b) often messes up scoping of variables as you need to move them outside the 'try' block.
- wruza 2y agoIt also creates additional finalization semantics for a using-ed value. Which has all sorts of implications. lock.do(async (lock) => {work}) is a similar construct - a scope-limited aquisition that requires nothing special. Catch/finally not sharing a scope with try is a repeated mistake, that I surely agree with!