ScalaSTM release 0.7

37 views
Skip to first unread message

Nathan Bronson

unread,
Dec 22, 2012, 1:11:35 AM12/22/12
to scala-stm-e...@googlegroups.com
I've finalized version 0.7.

The biggest improvement over 0.6 is TxnDebuggable, a trait that is implemented by all of the transactional types (Ref, Ref.View, TMap, TMap.View, ...). TxnDebuggable provides methods that will generate a String or debugger-friendly Object representation, without any permanent changes to the current transaction's read set. This lets you watch transactional types in a debugger without adding lots of new transaction conflicts, and allows you to drill into the contained value. See http://nbronson.github.com/scala-stm/api/0.7/index.html#scala.concurrent.stm.TxnDebuggable for more.

Thanks,
  Nathan

Hanns Holger Rutz

unread,
Dec 22, 2012, 3:52:47 AM12/22/12
to scala-stm-e...@googlegroups.com
that's great! would `dbgValue` be a good candidate for a `toString` method of an enclosing entity, in terms of no-interference with the transaction, or should it be purely for debugging?

best, .h.h.
> --
>
>
>

Nathan Bronson

unread,
Dec 22, 2012, 2:20:06 PM12/22/12
to scala-stm-e...@googlegroups.com
My opinion is that toString should return a transactionally correct value, and that there should be an alternate method for the transient snapshot. This makes it so that someone reading the code can see that the string is special. Also, dbgStr and dbgValue return a value even if the enclosing transaction has already been marked for rollback (they return info about the pending rollback), because that is the most useful thing when debugging.

If you want to write your own debugging helpers take a look at TxnExecutor.unrecorded, which does something like running a nested transaction and then rolling it back at the last moment. This way you can get a self-consistent dbgStr or dbgValue even for a data structure built from multiple Ref-s (like TMap).

 - Nathan


--






--
Nathan Grasso Bronson
ngbr...@gmail.com
Reply all
Reply to author
Forward
0 new messages