Review code style, refactor functions into namespaces

Issue #3 new
Michael Diamond
repo owner created an issue


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 (6)

  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 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. Michael Diamond reporter

    Different plan, along the lines of bash-cache:

    • pg::_foo for private helper functions
    • pg::foo for non-interactive functions such as those used by gems
    • pgem_foo for user-facing functions

    Gems should similarly use a bar:: namespace (where "bar" is the name of the gem) for non-user-facing functions.

    NB pg is a standard Unix command, so pg shouldn't be used directly.

  4. Log in to comment