3 ms·
Different feature, I'm talking about the optional initialization section added to conditionals. It allows moving declarations to the point of use like for state
by AlotOfReading 3y ago
Different feature, I'm talking about the optional initialization section added to conditionals. It allows moving declarations to the point of use like for statements. I've also met people who think it's now the appropriate place to declare all block scope variables, which is horrifying.
- cmrdporcupine 3y agoIt's horrifying but maybe also intriguing? Has shades of the OCaml/StandardML "let ... " scope: StandardML: let val a = 1 val b = 2 in a + b end It's nice for making it clear that the scope of the assignment is restricted to this lexical scope, though there are other ways to do this in C/C++. I work in Rust these days so haven't had a chance to use much of this, but I wonder if this has some nice RAII type use patterns? I may now go explore.