Skip to content

Instantly share code, notes, and snippets.

@samueltardieu
Created June 17, 2013 15:38
Show Gist options
  • Save samueltardieu/5797887 to your computer and use it in GitHub Desktop.
Save samueltardieu/5797887 to your computer and use it in GitHub Desktop.
Scala seems to always prefer value over call by name: `foo(true)` returns "foo1" and is not ambiguous. Why?
object Test {
def foo(t: Boolean) = "foo1"
def foo(t: => Boolean) = "foo2"
}
@gourlaysama
Copy link

@bateast: this doesn't compile for me (2.10.2), none of the two methods is applicable to an argument of type () => Boolean, because => T isn't a type, and isn't considered like a Function0[T] for applicability but like a T, just a weird, different one...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment