2014-04-28 19:29:18 +00:00
|
|
|
Nimrod Enhancement Proposal #1 - Standard Library Style Guide
|
|
|
|
|
|
|
|
Abstract
|
|
|
|
========
|
|
|
|
Although Nimrod, through its flexible AST and case-sensitivity settings,
|
|
|
|
supports a variety of code and formatting styles, it is nevertheless beneficial
|
|
|
|
that certain community efforts, such as the standard library, should follow
|
|
|
|
a consistant set of style guidelines when suitable. This enhancement
|
|
|
|
proposal aims to list a series of guidelines that the standard library should
|
|
|
|
follow. Note that these are *guidelines* only. The nature of Nimrod being
|
|
|
|
as flexible as it is, there will be parts of this style guide that don't make
|
|
|
|
sense in certain contexts. Furthermore, just as
|
2014-04-28 20:19:37 +00:00
|
|
|
[Python's style guide](http://legacy.python.org/dev/peps/pep-0008/) changes
|
2014-04-28 19:29:18 +00:00
|
|
|
over time, this style guide will too.
|
|
|
|
|
|
|
|
Style Guidelines
|
|
|
|
================
|
|
|
|
|
|
|
|
General
|
|
|
|
-------
|
|
|
|
- All identifiers, except for types, should be in pascalCase. Type identifiers
|
2014-04-28 20:19:37 +00:00
|
|
|
should be in CamelCase.
|
2014-04-28 19:29:18 +00:00
|
|
|
|
|
|
|
- Members of enums should have an identifying prefix before their
|
|
|
|
names. For example, the PathComponent enum in the os module contains the
|
|
|
|
pcFile member, which, like the other members, has the 'pc'
|
2014-04-28 20:19:37 +00:00
|
|
|
(standing for PathComponent) prefix before its name. An exception to this rule exists when using ``pure`` enums.
|
2014-04-28 19:29:18 +00:00
|
|
|
|
|
|
|
- Lines should be no longer than 80 characters
|
|
|
|
|
|
|
|
- 2 spaces should be used for indentation.
|
|
|
|
|
|
|
|
- The 'result' variable should be used whenever possible. 'return' should only
|
|
|
|
be used when it's flow control effects are needed.
|