Hacker News new | ask | show | jobs
by deepsun 1262 days ago
> Inner functions. Rust also supports inner functions. ...

> Closures (lambdas). Rust supports closures (also called Lambdas, arrow functions or anonymous functions in other languages).

That's misguiding.

Closures are not lambdas. Lambdas are just syntax, but the whole point about closures is that they capture the enclosing environment (have access to variables where it's defined). Rust's documentation states just that. Closures may or may not be lambdas.

In above example of "Inner functions" (which is also a closure) that would be more clearly explained if the inner function used an outside variable. Not all languages can do that.