Re-write closures chapter#23568
Conversation
src/doc/trpl/closures.md
Outdated
There was a problem hiding this comment.
Per rust-lang/rfcs#968 braces will be required here.
|
On the whole, I think this is very informative. It's use of Little was said about the differences between |
src/doc/trpl/closures.md
Outdated
There was a problem hiding this comment.
one warning: I expect that the fix for #23319 will cause this not to work unless you annotate the type of x (|x: i32|)
There was a problem hiding this comment.
makes sense. let's see which one lands first, I guess.
There was a problem hiding this comment.
well, it's still working
|
Added some commits to address some of the additional stuff. I think I'll wait till #23282 to land before I polish the rest off, since that changes some things. |
|
(#23282 landed) |
src/doc/trpl/closures.md
Outdated
There was a problem hiding this comment.
There's a comma splice in this sentence - how about:
Anonymous functions which have an associated environment are called 'closures' since they 'close' over their environment. Rust has a flexible implementation of closures that centers around overloading the calling operator: ().
You might want to drop the bit about (), but I just wanted to say something else in that sentence other than "the rust version is cool."
There was a problem hiding this comment.
introductions are hard. I re-worded this slightly, but don't know what exactly to add. I'm not sure describing it as () overloading really captures what I love about closures.
rendered
r? @nikomatsakis