Here is the following problem. When I run the following:
object Test {
def /:(s: => Unit) = {
println("/:")
s
}
}
println("A") /: Test
It prints:
A
/:
However, I was expecting it to print:
/:
A
since the last expression was supposedly rewritten Test./:(println("A"))
- which by the way, gives the second value.
Does anybody know a way to make the first syntax work, e.g. println("A") /: Test
but with call-by-name ?
Edit
Using the desugar method, I found out that the calls are desugared differently.
> desugar { println("A") /: Test}
val x$1: Unit = println("A");
Test./:(x$1)
Hence I am still wondering why this choice.