|
|
|
|
|
by earthboundkid
1917 days ago
|
|
> as most variables should never be reassigned. Why not? Reassigning globals can lead to bugs, sure. But when does reassigning a local lead to bugs? > By defaulting to const unless reassignment is necessary, you're essentially putting documentation into the actual code No, by defaulting to const, you're removing documentation. "Does this variable need to be kept safe from reassignment? Is it ever used again after this point in the code? Or is the developer just blindly using const for no reason?" Gotta read the code to figure it out because now const is just meaningless noise. |
|