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

Require (...) around parameters of a lambda #7156

Merged
merged 4 commits into from
Sep 3, 2019

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Sep 2, 2019

I.e.

{ x: Int => x + 1 }

is no longer legal, you have to write

{ (x: Int) => x + 1 }

Parentheses were already mandated by the syntax but the parser still allowed the old
syntax. Now, it does so only under -language:Scala2.

I.e.
```scala
{ x: Int => x + 1 }
```
is no longer legal, you have to write
```scala
{ (x: Int) => x + 1 }
```
Parentheses were already mandated by the syntax but the parser still allowed the old
syntax. Now, it does so only under -language:Scala2.
@jducoeur
Copy link
Contributor

jducoeur commented Sep 2, 2019

The title of this PR is concerning -- is that only for parameters with type ascriptions, or always? Specifically, are parens required around a single un-ascribed parameter? If so, I would say this is a step backwards ergonomically -- this is an enormously common pattern, and adding the extra ceremony is unfortunate...

@odersky
Copy link
Contributor Author

odersky commented Sep 2, 2019

@jducoeur No, just parameters with type ascriptions.

@odersky odersky force-pushed the change-lambda-syntax branch from 8a1d7ba to c5b9879 Compare September 2, 2019 18:56
@odersky odersky force-pushed the change-lambda-syntax branch from c5b9879 to b13116a Compare September 2, 2019 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants