-
Improvement
-
Resolution: Unresolved
-
Normal
-
None
-
None
This syntax is officially deprecated.
def someFun(x: String) { .... }
|
Instead one must write explicitly:
def someFun(x:String): Unit = { ... }
|
Meaning that the value of x.length is discarded and the function returns Unit (or () if you prefer) instead.
I'd like to stress out that this is deprecated since Oct 29, 2013 (https://github.com/scala/scala/pull/3076/), but the warning only shows up if you compile with the -Xfuture flag.
We should turn on the -Xfuture flag, and fix this and any other deprecations that come up.
We may want to write a sed-script or other automation. I have generally preferred the now-deprecated style in my code, so there are many many cases.
scala -Xfuture -deprecation
|
|
scala> def foo {}
|
<console>:1: warning: Procedure syntax is deprecated. Convert procedure `foo` to method by adding `: Unit =`.
|
def foo {}
|
foo: Unit
|