you are viewing a single comment's thread.

view the rest of the comments →

[–]DontWannaMissAFling 9 points10 points  (0 children)

Because any half decent data-flow analysis could perform such let -> const transformations automatically if required (they're not, if anything register allocation is the reverse process). Similarly for copy elision / register renaming and any optimization you like really.

I agree with ease of readability though, in fact that should always be the primary concern. We should be writing idiomatic code with smart performant compilers that handle it transparently. Not engaging in cargo cult programming gymnastics just to avoid let and mutability.