-
Notifications
You must be signed in to change notification settings - Fork 1k
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
FAQ: minor improvements to functions vs methods #3068
Conversation
_overviews/FAQ/index.md
Outdated
unless you absolutely need a function. And, thanks to | ||
[eta-expansion](https://stackoverflow.com/questions/39445018/what-is-the-eta-expansion-in-scala) | ||
you rarely would need to define a function rather than a method. | ||
Most code uses methods most of the time, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO we should not only note that most code uses methods but also encourage them as the default, given the syntax, performance, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I see what you mean, but my intent was actually to make the wording stronger, not to weaken it. I think the word "recommend" is sort of weak. Whereas I really want to say quite forcefully, methods are definitely the norm in this language.
Maybe I can find a different wording.
_overviews/FAQ/index.md
Outdated
[eta-expansion](https://stackoverflow.com/questions/39445018/what-is-the-eta-expansion-in-scala) | ||
you rarely would need to define a function rather than a method. | ||
Most code uses methods most of the time, | ||
unless a function value is actually needed. With |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In retrospect, we should have added an example, something like:
e.g. you will compose it with other functions using
andThen
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, good point, I can try to add something like that
_overviews/FAQ/index.md
Outdated
you rarely would need to define a function rather than a method. | ||
Most code uses methods most of the time, | ||
unless a function value is actually needed. With | ||
[eta-expansion](https://stackoverflow.com/questions/39445018/what-is-the-eta-expansion-in-scala), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if "With" is the best connector to use.
But, I am not known for my good level of written English 😅 it just feels off to me but that may as well be because I am not a native speaker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually hesitated over that; you're right to call it out.
Thanks for the feedback; I'll ponder some further edits.
@BalmungSan wdyt now? mergeable? note that I really don't want to make the answer even longer. FAQ answers should be short. so I'm willing to make further edits but only if they aren't expansions. the entry already links to longer explanations. |
fixup: cee9851 |
review by @BalmungSan ?
my initial motivation was to fix a place where Scala 3 was referred to in the future tense. but then while I was there I found I wanted to do some light rewriting