About
Articles Related
Properties
Name
- “camel case”. Example: QuoteRuneToASCII and parseRequestLine but never quote_rune_to_ASCII or parse_request_line.
- The letters of acronyms and initialisms like ASCII and HTML are always rendered in the same case, so a function might be called htmlEscape, HTMLEscape, or escapeHTML, but not escapeHtml.
Unnamed
The new function creates an unnamed variable.
Scope
- Local: If an entity is declared within a function
- Own Package: If declared outside of a function. The name of each package-level entity is visible not only throughout the source file that contains its declaration, but throughout all the files of the package.
- Across package: The case of the first letter of a name determines its visibility across package boundaries.
- If the name begins with an upper-case letter, it is exported (visible and accessible outside of its own package)
Lifetime
The lifetime of a name (variable) is the interval of time during which it exists as the program executes.
- The lifetime of a package-level variable is the entire execution of the program.
- By contrast, local variables have dynamic lifetimes: a new instance is created each time the declaration statement is executed, and the variable lives on until it becomes unreachable, at which point its storage may be recycled. Function parameters and results are local variables too; they are created each time their enclosing function is called.