Skip to content

Commit 4eb0729

Browse files
committed
add a sentence about type inference
1 parent 5ee86b2 commit 4eb0729

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

blog/_posts/2017-05-29-tribulations-canbuildfrom.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ def map[B](f: Char => B): Seq[B]
6565

6666
Then, if you call `map` with a function that returns a `Char`, the first overload is
6767
selected and you get a `String`. Otherwise, the second overload is selected and you
68-
get a `Seq[B]`.
68+
get a `Seq[B]`. Before Scala 2.12 such a solution would not have worked well: users
69+
would have been required to explicitly write the type of the argument of the supplied
70+
`f` function. In Scala 2.12 type inference has been improved so that it is not
71+
anymore necessary.
6972

7073
Thus, we got rid of the cryptic method signatures while still supporting the feature
7174
of returning a different type of result according to the type of the transformation function.

0 commit comments

Comments
 (0)