5 ms·
let is traditionally used for expressions, not types.
by Ono-Sendai 11y ago
let is traditionally used for expressions, not types.
- Animats 11y agoRust uses "let" to declare local variables using implicit typing. let one_to_one_hundred = (1..101).collect::<Vec<_>>();
- klodolph 11y agoWhat do you mean? Here, "auto" is being used to define a variable, just like the way "let" does in other languages. for (let i = results.begin( ); i != results.end( ); ++i) This matches the use of "let" in Haskell, Lisp, Rust, ES6, etc. (Note that when I say "variable" in this context, I am using it as the hypernym, not in the sense where it denotes only mutable variables.)
- Ono-Sendai 11y agoWhat I mean is that for me, 'auto' in C++ means something like 'automatic type', e.g. it stands in for the actual type, whereas let x = some_expr means something else - it doesn't really say anything directly about the type of x.