Updated Style Guide for Nim Code (markdown)
This commit is contained in:
parent
8dc1fd34dc
commit
d8a3935bc5
|
@ -60,12 +60,15 @@ changed in the future.
|
||||||
are not required to.
|
are not required to.
|
||||||
|
|
||||||
```nimrod
|
```nimrod
|
||||||
const aConstant = 42
|
const
|
||||||
const FooBar = 4.2
|
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.
|
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.
|
- Exception and Error types should have the "Error" suffix.
|
||||||
|
|
||||||
```nimrod
|
```nimrod
|
||||||
type UnluckyError = object of Exception
|
type
|
||||||
|
UnluckyError = object of Exception
|
||||||
```
|
```
|
||||||
|
|
||||||
- Unless marked with the `{.pure.}` pragma, members of enums should have an
|
- 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``).
|
(in the form of ``MyEnum.fooValue``).
|
||||||
|
|
||||||
```nimrod
|
```nimrod
|
||||||
type PathComponent = enum
|
type
|
||||||
|
PathComponent = enum
|
||||||
pcDir
|
pcDir
|
||||||
pcLinkToDir
|
pcLinkToDir
|
||||||
pcFile
|
pcFile
|
||||||
|
@ -106,7 +111,8 @@ changed in the future.
|
||||||
PascalCase.
|
PascalCase.
|
||||||
|
|
||||||
```nimrod
|
```nimrod
|
||||||
type PathComponent {.pure.} = enum
|
type
|
||||||
|
PathComponent {.pure.} = enum
|
||||||
Dir
|
Dir
|
||||||
LinkToDir
|
LinkToDir
|
||||||
File
|
File
|
||||||
|
|
Loading…
Reference in New Issue