Skip to content

Fix the first example under "Parameter Types of Function Values" #9519

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

Merged
merged 1 commit into from
Aug 18, 2020

Conversation

deanwampler
Copy link
Contributor

The example had two issues:

  1. It used f both as the name of the method and the argument. While it compiled, it seemed unnecessarily confusing to overload that name. So I changed the name of the function argument to +f2+.
  2. The example failed to compile because it passed +String+ and +String => Int+ arguments. I fixed the example and added another one example for +Int+ and +Int => Int+ arguments.

The example had two issues:
1. It used `f` both as the name of the method and the argument. While it compiled, it seemed unnecessarily confusing to overload that name. So I changed the name of the function argument to +f2+.
2. The example failed to compile because it passed +String+ and +String => Int+ arguments. I fixed the example and added another one example for +Int+ and +Int => Int+ arguments.
Copy link
Member

@dottybot dottybot left a comment

Choose a reason for hiding this comment

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

Hello, and thank you for opening this PR! 🎉

All contributors have signed the CLA, thank you! ❤️

Have an awesome day! ☀️

Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

Thanks @deanwampler 👍

Don't forget to sign the CLA: https://www.lightbend.com/contribute/cla/scala

def f(x: Int, f2: Int => Int) = f2(x)
def f(x: String, f2: String => String) = f2(x)
f("a", _.toUpperCase)
f(2, _ * 2)
```
Copy link
Contributor

Choose a reason for hiding this comment

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

What about using m for methods and keep f for function parameters?

@odersky
Copy link
Contributor

odersky commented Aug 18, 2020

Thanks for the fix, Dean!

@odersky odersky merged commit 64a239f into scala:master Aug 18, 2020
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.

4 participants