add answers to exercise 1-5 chapter 7#30
add answers to exercise 1-5 chapter 7#30axel22 merged 4 commits intoconcurrent-programming-in-scala:masterfrom
Conversation
| def second_=(x: Q)(implicit txn: InTxn) = rSecond.single.transform(old => x) | ||
|
|
||
| def swap()(implicit e: P =:= Q, txn: InTxn): Unit = { | ||
| val old = Ref[P](first) |
There was a problem hiding this comment.
It shouldn't be necessary to create a Ref object just to hold the value of the first field.
It is sufficient to read it via apply (i.e. just call first) and store the value of type P directly to the local variable.
val old = first
|
Thanks, looking good overall! I only left some minor comments for exercise 1. |
|
@axel22 |
use the apply method of e to convert directly P => Q
|
Hi @axel22, I use |
|
Unfortunately, not that I know of. Ideally, LGTM |
|
Thanks for your contribution! |
|
Thanks for the review |
Hi @axel22,
Pls see this answers