Last active
August 29, 2015 13:56
-
-
Save PhilipWitte/9314927 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change set's to @{} instead of {} | |
# which is consistent with seq | |
var mySet = @{ A, B, C } | |
var mySeq = @[ a, b, c ] | |
# Force ':' where ever a "body" is consumed which | |
# allows both indent style and bracket-style | |
# the follow types are all identical.. | |
type Foo* {.final.} = ref object: | |
a: int | |
b: float | |
type Foo* {.final.} = ref object [ | |
a: int, | |
b: float | |
] | |
type Foo* {.final.} = ref object { | |
a: int | |
b: float | |
} | |
# Move proc pragmas to the left, and use '=' for where ':' | |
# currently is, which makes it's meaning consistent with type declares | |
# the following procs are the same... | |
proc bar*(f:Foo) {.noSideEffect.} = float: | |
if f.isNil: 0 | |
else: f.a + f.b | |
proc bar*(f:Foo) {.noSideEffect.} = float { | |
if f.isNil: 0 | |
else: f.a + f.b | |
} | |
# Shorthands.. | |
type Foo: | |
a, b: int | |
proc bar: | |
echo ".." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment