Monday, January 12, 2015

[zpndokvh] Names allow typos

Whenever a programmer names something, especially when forced to name something even if it is later referenced only once, it creates an opportunity for a typo: typing the wrong name in the later reference.

For example, lambda lets you not name a function (though you are forced to name the arguments to the lambda).

Create a tool that will find opportunities for typos: two symbols in the same scope that can be substituted for one another but the program continues to compile fine.  Usually two variables (including functions) with the same type.  Probably want to exclude aliasing, i.e., both names refer to the same thing.

Tools which warn you when a name is defined but never referenced are also useful, perhaps good enough.

Previous thoughts on naming things and not naming things.

No comments :