3 ms·
> Disagree. Also this same logic can be applied to every other token (ie this argument suggests we should write minified code). No, it does not. Think of the t
by rad_gruchalski 6y ago
> Disagree. Also this same logic can be applied to every other token (ie this argument suggests we should write minified code).
No, it does not. Think of the type variable as a template. The value of this kind of variable does not change during the execution of a function, once given, stays the same. When reading code with generics it does not even make sense to compare the names across two different functions unless they are methods in a class.
Basically, a T in head<T> may be something else than T in tail<T> depending on what the container declares. And what if I use your head<Element> as my head<Leaf>. For me semantically it is not an Element so your forced generic naming is simply going to mess with my brain logic. Leave my T alone. My T is my Type, not some imaginary thing the person who wrote the API imagined I should be putting in there.
- nailer 6y ago> Think of the type variable as a template. The value of this kind of variable does not change. This new logic can be applied to every other constant. > When reading code with generics it does not even make sense to compare the names across two different functions unless they are methods in a class. Agreed. But I don't think anyone was discussing that.
- rad_gruchalski 6y ago> This new logic can be applied to every other constant. Constant is by definition constant. Generic type is known and bound only in the given code path and may differ across two different executions. That's not constant.