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.
This commit is contained in:
parent
7884eb8e2f
commit
994ccd30a0
1 changed files with 2 additions and 1 deletions
|
|
@ -75,7 +75,8 @@ This is a deliberate design decision. While full-program inference is possible,
|
|||
languages which have it, like Haskell, often suggest that documenting your
|
||||
types explicitly is a best-practice. We agree that forcing functions to declare
|
||||
types while allowing for inference inside of function bodies is a wonderful
|
||||
sweet spot between full inference and no inference.
|
||||
sweet spot between full inference and no inference. (For closures, i.e. unnamed
|
||||
functions, types do not have to be declared.)
|
||||
|
||||
What about returning a value? Here's a function that adds one to an integer:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue