Am I abusing `const`?
Using const
on local variables improves code clarity, so it's a good idea. You see const
and you immediately know that the variable is never changed later in scope. It's from the same series as making functions short and returning early.
Developers are lazy - they often think that it's a useless word that doesn't change anything. IMO they are wrong.
This is effectively the same reason why assertions are rarely used. const
on interfaces is mandatory, const
in the implementation is voluntary. Programmers are lazy.
Edit: just in case it isn't clear, your approach is better.