type of need" mean in Scala mean? When I try to skip points from method calls, as in this example pro...">

What does "recursive method <method name> type of need" mean in Scala mean?

When I try to skip points from method calls, as in this example program:

object Test extends Application {
  val baz = new Baz
  var foo = baz bar
  println(foo)
}

class Baz {
  def bar = "bar"
}

I get weird errors. The first is error: recursive method foo needs type: println foo, and the other is error: type mismatch; found: Unit, required: Int, println(foo). The first error is somehow strangely fixed if I indicate that the type fooshould be a string. The second of them will not disappear before you put a point between bazand bar. What is the reason for this? Why does Scala consider itself baz bara recursive method?

+5
source share
1 answer

, , , , .

var foo = baz.bar(println(foo))

, foo , StringOps.apply Int (String StringOps, String apply).

, < <28 > , .

+7

All Articles