Last active
August 29, 2015 14:00
-
-
Save rcoh/11387293 to your computer and use it in GitHub Desktop.
Scala Nested Closures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def inlineMeAgain[T](f: => T): T = { | |
f | |
} | |
def inlineme(f: => Int): Int = { | |
try { | |
inlineMeAgain { | |
return f | |
} | |
} catch { | |
case ex: Throwable => 5 | |
} | |
} | |
def doStuff { | |
val res = inlineme { | |
10 | |
} | |
println("we got: " + res + ". should be 10") | |
} | |
doStuff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment