News for hackers. Stuff that matters.
Re:Discipline Doesn’t Scale by andrewjl on Wednesday October 21, 2020 @07:34AM (#24846748)
There's something I've always been curious about wrt `auto`, and that's why have the keyword at all? In Swift for instance, one can just use `var` or `let` to express mutability and have the compiler infer the type. Is there a particular reason C++ can't, or perhaps chooses not to, do this?
Re:Discipline Doesn’t Scale by rkangel on Wednesday October 21, 2020 @08:44AM (#24847238)
I'm not sure there's a particular difference between the two except the keyword chosen. You type "auto my_var_name = func_call()" or you type "let my_var_name = func_call()". In both cases you get an inferred type for a variable.

Mutability is very different in C++ though - const is quite a complex topic, and isn't as simple as "this variable binding is/isn't mutable".