On Tuesday, 7 June 2022 at 18:37:13 UTC, Steven Schveighoffer
wrote:
[...]
My very common use of `scope(failure)` for my DB code:
```d
conn.exec("START TRANSACTION");
scope(success) conn.exec("COMMIT");
scope(failure) conn.exec("ROLLBACK");
```
Are there multiple (successful) returns in your code or why are
you executing the COMMIT under a scope exit clause? If there is
only one successful return wouldn't it enhance code readability
when an explicit COMMIT precedes the return?
Is the ROLLBACK really necessary? Isn't the transaction not
committed (i.e. rolled back) when the db handle is closed? Why
not have a Transaction class (struct)?