Hi,
What is the status of Concepts in Nim 0.19?
Are they still considered experimental or are they stable to use? If they are still experimental, is it known when they will probably reach stable state?
TIA Rouan
They work, I've been using somewhat advanced concepts without issue in my neural net lib:
TrainableLayer*[TT] = concept layer
block:
var trainable: false
for field in fields(layer):
trainable = trainable or (field is Variable[TT])
trainable
Conv2DLayer*[TT] = object
weight*: Variable[TT]
bias*: Variable[TT]
LinearLayer*[TT] = object
weight*: Variable[TT]
bias*: Variable[TT]
GRULayer*[TT] = object
W3s0*, W3sN*: Variable[TT]
U3s*: Variable[TT]
bW3s*, bU3s*: Variable[TT]
The most advanced used of Concepts is probably Emmy
type
AdditiveMonoid* = concept x, y, type T
x + y is T
zero(T) is T
AdditiveGroup* = concept x, y, type T
T is AdditiveMonoid
-x is T
x - y is T
MultiplicativeMonoid* = concept x, y, type T
x * y is T
id(T) is T
MultiplicativeGroup* = concept x, y, type T
T is MultiplicativeMonoid
x / y is T
Ring* = concept type T
T is AdditiveGroup
T is MultiplicativeMonoid
EuclideanRing* = concept x, y, type T
T is Ring
x div y is T
x mod y is T
Field* = concept type T
T is Ring
T is MultiplicativeGroup
but use within the standard lib is still pending but planned for Iterable and Indexable concepts though I'm worried about compilation time (that I did not experience yet)
Thanks @mratsim,
I will then start using them :)
Thanks for always replying even on very n00b questions. I have found Nim's community really great because of this.
Regards
though I'm worried about compilation time (that I did not experience yet)
I share these concerns... And until I understand why and when they happen I cannot make the stdlib use them. :-)