> Depends on the f. If it's a function it will be evalauted twice (which
> may be expensive)
More than expensive, it actually made a mongodb test fail.
It took me a few hours of tracking down which change was causing this
one mongodb test to fail, it was one where encrypting the password did
not result in the correct encryption. I had to go and undo one file at
the time to see where the problem was, and once I changed the code in
FatLazy.scala to:
def get: T = synchronized {
value match {
case Full(v) => v
case _ => value = Full(f)
value.openOrThrowException("We just checked that this is a Full box.")
}
}
then the test passed again.
For the record, the test that was failing was:
[info] MongoRecordExamples Specification
[info]
[error] x TstRecord example
[error] the value is not equal to 'true' (MongoRecordExamplesSpec.scala:289)
[info] + Ref example
[info] + List example
[info] + Map Example
[info] + Optional Example
[info] + Strict Example
[info]
[info] Total for specification MongoRecordExamples Specification
and the code in FatLazy that made it fail was:
def get: T = synchronized {
value match {
case Full(v) => v
case _ => value = Full(f)
f
}
}
Thanks,
Diego
>
> /Jeppe