nim-wiki/NEP-1.md

34 lines
1.4 KiB
Markdown
Raw Normal View History

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
[Python's style guide](http://legacy.python.org/dev/peps/pep-0008/) changes
over time, this style guide will too.
Style Guidelines
================
General
-------
- All identifiers, except for types, should be in pascalCase. Type identifiers
should be in CamelCase.
- 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'
(standing for PathComponent) prefix before its name. An exception to this rule exists when using ``pure`` enums.
- 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.