Where can I find documentation for Scala's delayed function calls?
Posted
by Geo
on Stack Overflow
See other posts from Stack Overflow
or by Geo
Published on 2009-12-15T17:26:23Z
Indexed on
2010/05/16
9:50 UTC
Read the original article
Hit count: 192
I saw a delayed
example in David Pollak's "Beginning Scala"
. I tried to adapt that, by trial and error. Here's what I have:
def sayhello() = {
println("hello")
}
def delaying(t: => Unit):Unit = {
println("before call")
t
println("after call")
}
delaying(sayhello())
How would you delay a function/method that takes parameters? Why can't I use parantheses when I call t
? Where can I find more documentation on delaying functions?
© Stack Overflow or respective owner