breaking change: 'concept' is now a keyword and used instead of 'generic'

This commit is contained in:
Araq 2015-03-23 00:51:04 +01:00
commit f6ff01572e
15 changed files with 462 additions and 475 deletions

View file

@ -22,7 +22,7 @@ template reject(e: expr) =
static: assert(not compiles(e))
type
Container[T] = generic C
Container[T] = concept C
C.len is Ordinal
items(c) is iterator
for value in C:

View file

@ -40,7 +40,7 @@ proc isSwizzle(s: string): bool {.compileTime.} =
return false
type
StringIsSwizzle = generic value
StringIsSwizzle = concept value
value.isSwizzle
SwizzleStr = static[string] and StringIsSwizzle

View file

@ -16,10 +16,10 @@ type
TObj = object
x: int
Sortable = generic x, y
Sortable = concept x, y
(x < y) is bool
ObjectContainer = generic C
ObjectContainer = concept C
C.len is Ordinal
for v in items(C):
v.type is tuple|object
@ -38,7 +38,7 @@ proc intval(x: int): int = 10
# check real and virtual fields
type
TFoo = generic T
TFoo = concept T
T.x
y(T)
intval T.y
@ -50,7 +50,7 @@ proc testFoo(x: TFoo) = discard
testFoo(TObj(x: 10))
type
Matrix[Rows, Cols: static[int]; T] = generic M
Matrix[Rows, Cols: static[int]; T] = concept M
M.M == Rows
M.N == Cols
M.T is T

View file

@ -1,5 +1,5 @@
type
hasFieldX = generic z
hasFieldX = concept z
z.x is int
obj_x = object
@ -7,7 +7,7 @@ type
ref_obj_x = ref object
x: int
ref_to_obj_x = ref obj_x
p_o_x = ptr obj_x