scala-dev icon indicating copy to clipboard operation
scala-dev copied to clipboard

deprecate multi-parameter infix operations

Open adriaanm opened this issue 7 years ago • 11 comments
trafficstars

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")

adriaanm avatar May 10 '18 13:05 adriaanm

@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)

adriaanm avatar Nov 03 '18 14:11 adriaanm

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

adriaanm avatar Nov 03 '18 14:11 adriaanm

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)

adriaanm avatar Nov 03 '18 14:11 adriaanm

new proposal at https://github.com/lampepfl/dotty/pull/4311#issuecomment-435593905

SethTisue avatar Nov 03 '18 15:11 SethTisue

note that new proposal includes a 2.13 change (warning on definition)

SethTisue avatar Dec 06 '18 17:12 SethTisue

@adriaanm where do we stand on this for RC1?

SethTisue avatar Feb 20 '19 22:02 SethTisue

This will need to wait until later in 2.13.x

adriaanm avatar Feb 20 '19 23:02 adriaanm

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

eed3si9n avatar Feb 24 '19 19:02 eed3si9n

Here's a PR to deprecate multi-parameter symbolic method decl - https://github.com/scala/scala/pull/7792

eed3si9n avatar Feb 25 '19 02:02 eed3si9n

Here's deprecation on the application side under -Xsource:2.14 - https://github.com/scala/scala/pull/7795

eed3si9n avatar Feb 25 '19 18:02 eed3si9n

Somewhere I threatened a lint if deprecation was dropped.

https://github.com/scala/scala/pull/8951

som-snytt avatar May 03 '20 08:05 som-snytt

out of scope for Scala 2

SethTisue avatar Jan 23 '23 18:01 SethTisue