Why does line #2 below compile? It's (seemingly) not giving the required constructor arg.
class F(x: => Unit) {}
new F // Compiles (strange)
def f(x: =>Unit) = ()
f // Does not compile (good)
Is it permitted sugar just for this special case? Can you point to docs on the subject? I'm using Scala 2.9.0.
Scala Reference:
5.1.1 Constructor Invocations
If no explicit arguments are given, an empty list () is implicitly supplied.
,where ()
stands for Unit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With