3 ms·
This is true, but it's also true that a lock ought only be held in the lexical scope of its guard's let binding. That the scope of temporaries is extended outsi
by colanderman 2y ago
This is true, but it's also true that a lock ought only be held in the lexical scope of its guard's let binding. That the scope of temporaries is extended outside the binding scope in this one case is surprising.
In a review I'd flag code which depended on this behavior -- it's much clearer instead to simply take the lock outside the if statement.