Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate infix type args, as they are dropped in Scala 3 #10255

Merged
merged 1 commit into from Jan 6, 2023

Conversation

som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Jan 5, 2023

Type arguments for infix expressions were added but never included in the specification and never received any support in Scala 3. They are now deprecated in Scala 2 and error under -Xsource:3.

For example, the 4th expression below is deprecated. In general, Scala 3 encourages only symbolic operators as infix operators, and never allows type arguments.

scala> xs.map(_ + 1)
val res1: List[Int] = List(43)

scala> xs map (_ + 1)
val res2: List[Int] = List(43)

scala> xs.map[Int](_ + 1)
val res3: List[Int] = List(43)

scala> xs map[Int] (_ + 1)
val res4: List[Int] = List(43)

@som-snytt som-snytt marked this pull request as ready for review January 6, 2023 03:53
@scala-jenkins scala-jenkins added this to the 2.13.11 milestone Jan 6, 2023
Copy link
Member

@lrytz lrytz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thank you!

@lrytz lrytz enabled auto-merge January 6, 2023 11:00
@lrytz lrytz merged commit 83908d9 into scala:2.13.x Jan 6, 2023
@SethTisue SethTisue changed the title Infix type args dropped in Scala 3 Deprecate infix type args, as they are dropped in Scala 3 Jan 6, 2023
@SethTisue SethTisue added the release-notes worth highlighting in next release notes label Jan 6, 2023
@SethTisue
Copy link
Member

The mailing list discussion linked from the original PR

link?

@som-snytt
Copy link
Contributor Author

a1c00ae

The commit message also shows the infix expression in the style of the era.

Today, infix prefers operators, especially for leading infix syntax (which requires backquoted alnum identifiers).

@som-snytt som-snytt deleted the deprecate/infix-type-arg branch January 6, 2023 18:17
@SethTisue
Copy link
Member

SethTisue commented Jan 8, 2023

@som-snytt would you mind updating the PR description to tell readers, who might be fairly casual users of Scala and haven't followed this stuff, what the change is, in a self-contained way? with an example of what "infix type args" even are?

@som-snytt
Copy link
Contributor Author

preserving the OP

Under -Xsource:3, error.

The feature was adopted during the dotless craze of 2013, but never taken up by dotty for obvious reasons (naming).

The mailing list discussion linked from the original PR shows only partial consensus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes worth highlighting in next release notes
Projects
None yet
4 participants