The nearest thing to
case class Foo(lazy next: Foo)
that I have been able to come up with is
class Foo(_next: =>Foo) {
lazy val next = _next
}
object Foo {
def apply(next: =>Foo) = new Foo(next)
def unapply(foo: Foo) = Some(foo.next)
}
I found a listed issue add lazy parameters so I guess it will be added someday. In the meantime, does anyone know a cleaner trick than the above?