Skip to content

Commit 562b744

Browse files
committed
FAQ: minor improvements to functions vs methods
1 parent 482685d commit 562b744

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

_overviews/FAQ/index.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,18 +244,19 @@ differ from a function value such as:
244244

245245
val square: Int => Int = x => x * x
246246

247-
For Scala 2, there is a [complete answer on Stack Overflow](https://stackoverflow.com/a/2530007/4111404)
247+
For **Scala 2**, there is a [complete answer on Stack Overflow](https://stackoverflow.com/a/2530007/4111404)
248248
and a [summary with practical differences](https://tpolecat.github.io/2014/06/09/methods-functions.html).
249249

250-
Note that in **Scala 3** the differences are fewer;
251-
for example, they will be able to
252-
[accept implicit parameters]({{ site.scala3ref }}/contextual/context-functions.html)
253-
as well as [type parameters]({{ site.scala3ref }}/new-types/polymorphic-function-types.html).
250+
In **Scala 3**, the differences are fewer.
251+
[Context functions]({{ site.scala3ref }}/contextual/context-functions.html)
252+
accept given parameters and
253+
[polymorphic functions]({{ site.scala3ref }}/new-types/polymorphic-function-types.html)
254+
have type parameters.
254255

255-
Nevertheless, it is still recommended to use methods most of the time,
256-
unless you absolutely need a function. And, thanks to
257-
[eta-expansion](https://stackoverflow.com/questions/39445018/what-is-the-eta-expansion-in-scala)
258-
you rarely would need to define a function rather than a method.
256+
Most code uses methods most of the time,
257+
unless a function value is actually needed. With
258+
[eta-expansion](https://stackoverflow.com/questions/39445018/what-is-the-eta-expansion-in-scala),
259+
a method can be converted as a function when needed.
259260

260261
### What's the difference between types and classes?
261262

0 commit comments

Comments
 (0)