Skip to content

Instantly share code, notes, and snippets.

@klgraham
Created September 22, 2012 23:11
Show Gist options
  • Save klgraham/3768172 to your computer and use it in GitHub Desktop.
Save klgraham/3768172 to your computer and use it in GitHub Desktop.
Advantage of occasional call-by-name
def loop: Int = loop // this is allowed
def first(a: Int, b: Int): Int = a
def first1(a: Int, b: => Int): Int = a
first(3 + 4, loop) // this will fail
first1(3 + 4, loop) // this will return 7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment