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:
Ingo Blechschmidt 2015-02-06 23:14:51 +01:00
parent 7884eb8e2f
commit 994ccd30a0

View file

@ -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: