I'm working with Gatling using Scala IDE (Eclipse Luna) and I ran into this issue that I would like to understand.
I have this function
import io.gatling.core.session.Session
import io.gatling.core.Predef._
object Predef {
def justDoIt(param: String): Session => Session = s => s.set("some", param)
}
And I'm trying to use it that way
val testScenario1 = scenario("Test")
.exec(justDoIt("hello world"))
val testScenario2 = scenario("Test")
.exec(justDoIt("hello world")(_))
For some reason, only the latter compiles. The former is complaining about the overload not applicable on argument of type Session => Session.
I would like to understand the difference between those two lines and why is the first one failing to compile.
I also did the following test and both syntax seems to be doing the same thing:
scala> def hello(fn: String => String) = fn("Hello")
hello: (fn: String => String)String
scala> def message(name: String): String => String = greeting => s"$greeting $name"
message: (name: String)String => String
scala> hello(message("world"))
res1: String = Hello world
scala> hello(message("world")(_))
res2: String = Hello world