Updated Style Guide for Nim Code (markdown)

This commit is contained in:
Andreas Rumpf 2016-06-16 22:07:08 +02:00
parent 8dc1fd34dc
commit d8a3935bc5
1 changed files with 21 additions and 15 deletions

View File

@ -60,12 +60,15 @@ changed in the future.
are not required to.
```nimrod
const aConstant = 42
const FooBar = 4.2
const
aConstant = 42
FooBar = 4.2
var aVariable = "Meep"
var
aVariable = "Meep"
type FooBar = object
type
FooBar = object
```
For constants coming from a C/C++ wrapper, ALL_UPPERCASE are allowed, but ugly.
@ -86,7 +89,8 @@ changed in the future.
- Exception and Error types should have the "Error" suffix.
```nimrod
type UnluckyError = object of Exception
type
UnluckyError = object of Exception
```
- Unless marked with the `{.pure.}` pragma, members of enums should have an
@ -95,7 +99,8 @@ changed in the future.
(in the form of ``MyEnum.fooValue``).
```nimrod
type PathComponent = enum
type
PathComponent = enum
pcDir
pcLinkToDir
pcFile
@ -106,7 +111,8 @@ changed in the future.
PascalCase.
```nimrod
type PathComponent {.pure.} = enum
type
PathComponent {.pure.} = enum
Dir
LinkToDir
File