Yuval Kogman wrote:
everyone gets to choose, and another thing I have in mind is the
Transactional role...
        DBI::Handle does Transactional;
To the STM rollbacker and type checker thingy this means that any IO
performed by DBI::Handle invoked code is OK - it can be reversed
using the Transactional interface it proposes.

Is this needed, when you can just;

  atomic {
     unsafeIO { $dbh.begin_work };

     unsafeIO { $dbh.do(...) };

     unsafeIO { $dbh.commit };
  } CATCH {

Of course, these unsafeIO calls can go inside a higher level wrapper
for the DBI, assuming that it is possible to detect whether or not
we are running in an atomic{ }, and "which" atomic block we are in.

As for the efficiency of things, hate to say it but that's really up
to the backend in use, and it's highly unlikely that anything other
than Parrot or GHC will support atomic{ }.

However a standard Role for this kind of behaviour might make sense.
Maybe draw up a prototype?


Reply via email to