File tree Expand file tree Collapse file tree 2 files changed +22
-20
lines changed
docs/docs/reference/changed Expand file tree Collapse file tree 2 files changed +22
-20
lines changed Original file line number Diff line number Diff line change 11---
22layout : doc-page
3- title : " Automatic Eta Expansion"
3+ title : " Automatic Eta Expansion - More Details "
44---
55
66### Motivation
@@ -47,25 +47,6 @@ f1: (Boolean, String) => Int => List[Int]
4747f2: Int => List [Int ]
4848```
4949
50- ## Automatic eta-expansion and nullary methods
51-
52- Automatic eta expansion does not apply to "nullary" methods that take an empty parameter list. Given
53-
54- ``` scala
55- def next (): T
56- ```
57-
58- A simple reference to ` next ` does not auto-convert to a function.
59- One has to write explicitly ` () => next() ` to achieve that
60- Once again since the ` _ ` is going to be deprecated it's better to write it this way
61- rather than ` next _ ` .
62-
63- The reason for excluding nullary methods from automatic eta expansion
64- is that Scala implicitly inserts the ` () ` argument, which would
65- conflict with eta expansion. Automatic ` () ` insertion is
66- [ limited] ( ../dropped/auto-apply.md ) in Dotty, but the fundamental ambiguity
67- remains.
68-
6950## Automatic eta-expansion and implicit parameter lists
7051
7152Methods with implicit parameter lists will always get applied to implicit arguments.
Original file line number Diff line number Diff line change @@ -17,5 +17,26 @@ f1: (Boolean, String) => Int => List[Int]
1717f2: Int => List [Int ]
1818```
1919
20+ The syntax ` m _ ` is no longer needed and will be deprecated in the future.
21+
22+ ## Automatic eta-expansion and nullary methods
23+
24+ Automatic eta expansion does not apply to "nullary" methods that take an empty parameter list.
25+
26+ ``` scala
27+ def next (): T
28+ ```
29+
30+ Given a simple reference to ` next ` does not auto-convert to a function.
31+ One has to write explicitly ` () => next() ` to achieve that
32+ Once again since the ` _ ` is going to be deprecated it's better to write it this way
33+ rather than ` next _ ` .
34+
35+ The reason for excluding nullary methods from automatic eta expansion
36+ is that Scala implicitly inserts the ` () ` argument, which would
37+ conflict with eta expansion. Automatic ` () ` insertion is
38+ [ limited] ( ../dropped/auto-apply.md ) in Dotty, but the fundamental ambiguity
39+ remains.
40+
2041[ More details] ( eta-expansion-spec.html )
2142
You can’t perform that action at this time.
0 commit comments