code style

A code style is a set of rules and directions on how source code should be formatted and structured. With Tcl in particular a code style may concern

  • Procedure names
    • lowerCameCase, nocaseatall or lower-case-with-dashes?
    • verb (e.g., set) or noun (e.g., ::http::data)?
  • Variable names
  • Indentation (typically tabs vs. 4 spaces)
  • Class names
    • lower (Snit) or CamelCase (common with TclOO)
  • Curly brace and square bracket placement
  • Namespace definition
    • namespace eval ::ns { proc hi ... } or namespace eval ::ns {}; proc ns::hi ... }?