Skip to content

Instantly share code, notes, and snippets.

@jstrachan
Created March 16, 2010 12:33
Show Gist options
  • Select an option

  • Save jstrachan/333917 to your computer and use it in GitHub Desktop.

Select an option

Save jstrachan/333917 to your computer and use it in GitHub Desktop.
scala> def bar(body:() => String) { println("start"); body(); println("end") }
bar: (body: () => String)Unit
scala> implicit def body(body: => Unit): () => String = () => { println("capturing"); body; "answer" }
body: (body: => Unit)() => String
scala> bar { println("hey"); println("bar") }
hey
start
capturing
bar
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment