On Wednesday, 15 June 2022 at 03:09:56 UTC, Steven Schveighoffer
wrote:
I don't see what you see wrong with the code I wrote. It's
straightforward, obvious, and does the job I need it to do, in
a way that's not prone to future mistakes.
Sometimes it is not easy to explain why code "feels" wrong and in
the case of
```
scope(success) conn.exec("COMMIT");
```
it was not that clear to me some days ago. The reason why I would
not write
it is: `conn.exec("COMMIT")` may throw! Think of deferred
constraints which are checked not before the commit. But "[a]
[...] scope(success) statement may not exit with a throw [...]"
[1]
[1] https://dlang.org/spec/statement.html#ScopeGuardStatement