Echo Writes Code

00000005-open-simplify_function_names.md

Simplify function names, especially constructors and accessors

Explanation

We have lots of function that have names like make_immutable_slice_from_pointer_and_size(). Names this long are obviously not fantastic.

Additionally, accessors tend to read quite well when written as just the thing being accessed, since it just looks like a member variable (but you can tell a computation happens because of the trailing () pair).

There might be a couple of other stray function names that can be shortened without losing any important information.

Task

  • Convert all constructors to the form make_xyz(), where xyz is the snake-cased name of the type being constructed. Exceptions can be made in cases where an ambiguous override would be created or where the longer name really adds some useful context.
  • Remove the get_ prefix from all accessors.
  • Evaluate any function name longer than 2-3 words and see if it really needs to be that long.