Hoisting Expressions (opens in new tab)
IntroductionThere is an RFC open on Rust which proposes what I’m calling hoisting expressions into the language. These are expressions which can be introduced inside of closures-only (for now), and are hoisted by the compiler to run before the rest of the closure does. To illustrate how they work, consider this example: rustprint!("hello "); hoist { print!("world!") };CopyEven though in the code we declared "hello " first and "world!" second, this will print: world!hello . In a way, you can t...
Read the original article