Re:Building native macOS applications with Rust
by steveklabnik on Wednesday November 30, 2016 @02:37PM
(#13073906)
C++ lambdas and Rust closures are very similar as far as I know, the only major difference being that they use explicit capture lists and we don't.
[ Parent
| on HN ]
Re:Building native macOS applications with Rust
by JoshTriplett on Wednesday November 30, 2016 @04:17PM
(#13074768)
On the other hand, Rust closures do compute the capture list, and then let the type system reason about the safety of those captures, which C++ lambdas (or blocks with the clang blocks extension) don't.
Re:Building native macOS applications with Rust
by problems on Wednesday November 30, 2016 @04:47PM
(#13075018)
Ah okay, so rust will only ever capture the minimal set of what's necessarily used in the lambda? Different from using [&] or similar in C++ where you capture everything.
Re:Building native macOS applications with Rust
by problems on Wednesday November 30, 2016 @02:44PM
(#13073973)
Yeah, in C++ you can sort of get away without explicit capture of all variables too by doing [=] or [&]. Though I suppose it's still explicit in a way, just saves the need to list everything.