Skip to content

Commit 994ccd3

Browse files
committed
Note that types do not have to be declared in closures
Without such a clarification, people who know and love closures (for instance programmers with a Haskell background) might fear that types would have to be declared in closures and that therefore using closures would be much more unwieldy.
1 parent 7884eb8 commit 994ccd3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/doc/trpl/functions.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ This is a deliberate design decision. While full-program inference is possible,
7575
languages which have it, like Haskell, often suggest that documenting your
7676
types explicitly is a best-practice. We agree that forcing functions to declare
7777
types while allowing for inference inside of function bodies is a wonderful
78-
sweet spot between full inference and no inference.
78+
sweet spot between full inference and no inference. (For closures, i.e. unnamed
79+
functions, types do not have to be declared.)
7980

8081
What about returning a value? Here's a function that adds one to an integer:
8182

0 commit comments

Comments
 (0)