Is 'concepts' is being polished/refurbished as a major feature in v2 - I hope it is.
I am assuming the code below is a known problem; compilation is slow and nothing is produced as output. This is on devel 1.9.5.
type
Distribution = concept
proc sample(d: Self): float
Die[float] = object
sides: int
func sample(d: Distribution): float =
rand(1..d.sides)
let D = Die[float](sides: 6)
echo sample D
nimThis infinite recursive definition ! Distribution not concrete type ! Need use Die !
Yes, it is defining a distribution as something that can be sampled.
In the old form of 'concepts', this would be an infinite recursion as has been explained to me already in some other thread but my understanding is that in this new, unfinished form of 'concepts', procs with a Self parameter are allowed.
So, as long as the concrete type can be sampled, it should work.