9

What is the idiomatic scala way to force computation on lazy value?

3
  • 3
    Call it, or don't make it lazy. Commented Jun 9, 2012 at 1:20
  • Why do you want to force a lazy value computation ? Why do you make it lazy ? It really looks like a code smell... Commented Jun 9, 2012 at 12:42
  • 3
    I make it lazy to untie knot with mutual dependencies over immutable data structures. I need to force it in right place to untie dependencies in a way to escape stack overflow with uncontrolled recursion. Commented Jun 9, 2012 at 19:52

1 Answer 1

16

Just call it:

lazy val x = someOperation()
// ...
x
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.