Skip to content

Instantly share code, notes, and snippets.

@tpolecat
Last active December 15, 2015 19:49
Show Gist options
  • Save tpolecat/5314444 to your computer and use it in GitHub Desktop.
Save tpolecat/5314444 to your computer and use it in GitHub Desktop.
object WAT extends App {
object Foo {
def !:(n: => Any) = "foo"
}
lazy val a = { println("AAA"); 1 }
lazy val b = { println("BBB"); 1 }
Foo.`!:`(a) // ok
b !: Foo // rewritten as { val x = b; Foo.`!:`(x) }
// per 6.12.3 and thus forces `b`, oops
}
// output is BBB
@tpolecat
Copy link
Author

tpolecat commented Apr 4, 2013

Ok so, for real? Is it actually impossible to write a nonstrict right-associative operator in Scala?

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