Comparing Exceptions and Errors
kdevel
kdevel at vogtner.de
Tue Jun 14 22:20:23 UTC 2022
On Monday, 13 June 2022 at 13:15:42 UTC, Steven Schveighoffer
wrote:
> Possibly, but I don't close the handle. It goes back to a pool
> to get reused.
Um. I need a (fresh) connection per CGI process. I wonder if
nowadays the TLS startup between the browser and the webserver
isn't at least one or two magnitudes more expensive than the
(unencrypted) connection to the domain socket of the DB engine.
May pooling DB connections instead of closing them be optimizing
on the wrong end?
>> Why not have a Transaction class (struct)?
>
> A transaction class/struct cannot hook normal return and
> throwing differently (the destructor has no way of knowing
> whether an exception is in flight).
Regarding C++: “[...] In a proper robust design, commits should
always be explicit and destructors only rollback uncommitted
transactions. [...]
There is now enough introspection in the language to actually
implement implicit commit in a non exceptional path, but I think
it would be a mistake."
[1] https://news.ycombinator.com/item?id=24648406
More information about the Digitalmars-d-learn
mailing list