Review code style, refactor functions into namespaces

Issue #3 new
Michael Diamond
repo owner created an issue

Reference https://google.github.io/styleguide/shell.xml

The Google Style Guide suggests using :: to delimit function namespaces, but that prevents tab-completion (perhaps that's an advantage?). . seems to be a common choice which does enable tab-completion.

Comments (5)

  1. Michael Diamond reporter

    There are really a couple different namespaces to support:

    • __pgem::: truly private, used only internally by ProfileGem (e.g. the functions in privateGemFunctions.sh and other helpers)
    • _pgem_: Utility functions intended to be used by gems
    • pgem_: User-facing functions intended to be called interactively
  2. Michael Diamond reporter

    Gems should also have standard namespaces:

    • __foo_gem:: for foo.gem's private fields
    • _foo_gem_ for fields that will be accessed by other gems
    • User-facing functions and variables should not be namespaced
  3. Log in to comment