343289 (1) [Avatar] Offline
#1
Hi!

Looks like the three function bodies in listing 2.14 (Managing latency as effects in Scala) still have to be wrapped into a Future.

E.g.:
def calculateInterest[A <: SavingsAccount](account: A,
  balance: BigDecimal):Future[BigDecimal] = {
  if (acc.rate == 0) throw new Exception("Interest Rate not found")
  else BigDecimal(10000)
}


should be

def calculateInterest[A <: SavingsAccount](account: A,
  balance: BigDecimal):Future[BigDecimal] = Future {
  if (acc.rate == 0) throw new Exception("Interest Rate not found")
  else BigDecimal(10000)
}


Like your book a lot! Can't wait for the next chapters!
Debasish Ghosh (116) [Avatar] Offline
#2
You are absolutely correct! Noted and recorded as an issue that I will fix in the upcoming MEAP. Thanks for the kind words.