scala-dev
scala-dev copied to clipboard
deprecate multi-parameter infix operations
use a tuple instead
this enables a better story for auto-tupling (https://github.com/lampepfl/dotty/pull/4311)
deprecation path (for a given -Xsource level):
- 2.14:
- deprecation warning: application involving a multi-param infix operation
- 3.0:
- behavior change: application involving a multi-param infix operation is only allowed if the method takes a single argument, args are tupled
- warning: definition of a symbolic method with multiple params ("cannot be used infix")
@smarter suggests we start warning on definition in 2.13, this way library authors can either mark symbolic multi-param methods as @deprecated in their library (and thus not get the deprecation warning that scalac emits)
note that the 2.14 warning shouldn't fire on method that take a single argument list, since those will still be ok in 3.0
the main goal being that the following applications will remain accepted during the whole upgrade (for time-varying reasons)
(x, y) :: xs
a == (b ,c)
the following will warn / error over time:
x += (1, 2, 3)
x add (a, b, c)
(because they take multiple arguments)
new proposal at https://github.com/lampepfl/dotty/pull/4311#issuecomment-435593905
note that new proposal includes a 2.13 change (warning on definition)
@adriaanm where do we stand on this for RC1?
This will need to wait until later in 2.13.x
Since we are shipping a bunch of collection changes in 2.13, and multi-parameter +s are already on deprecation track, I sent a PR to replace them with custom compilation error telling ppl to use ++ instead - https://github.com/scala/scala/pull/7790
Here's a PR to deprecate multi-parameter symbolic method decl - https://github.com/scala/scala/pull/7792
Here's deprecation on the application side under -Xsource:2.14 - https://github.com/scala/scala/pull/7795
Somewhere I threatened a lint if deprecation was dropped.
https://github.com/scala/scala/pull/8951
out of scope for Scala 2