Concepts in Nim v2

2023-07-25 Thread termer
@Araq Hahaha you haven't forgotten, eh. I'm using microasynchttpserver in some limited projects to see how it does. Time is lacking these days, but I've also played around with disruptek's CPS project and webserver implemented in it, which performs extremely well. I wouldn't mind building stream

Concepts in Nim v2

2023-07-25 Thread Araq
Don't worry, I do believe you. Now where is this Nim server of yours that supports streaming?

Concepts in Nim v2

2023-07-25 Thread termer
New-style concepts are super broken right now, and concepts in general are unusable when you're trying to use generics. Believe me, I've tried. I'd be really happy if there was an overhaul of concepts in v2, but I don't expect it.

Concepts in Nim v2

2023-07-22 Thread TKD
My misunderstanding! I fixed this now. It should indeed be 'Die' as the sample parameter.

Concepts in Nim v2

2023-07-22 Thread Calonger
You need use Die to make Die Distribution. You not define sample on Die , you define sample for Distribution , which infinite recursive ( define sample for type with sample defined )

Concepts in Nim v2

2023-07-22 Thread TKD
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` paramete

Concepts in Nim v2

2023-07-22 Thread TKD
Then, there is no need for the concept if I use 'Die'. See my reply to sls1005.

Concepts in Nim v2

2023-07-22 Thread Calonger
`` Die[float] = object `` mean what ?? Float is not generic parameter ! func sample(d: Distribution): float = rand(1..d.sides) This infinite recursive definition ! Distribution not concrete type ! Need use Die !

Concepts in Nim v2

2023-07-22 Thread sls1005
It's like saying "`sample` takes a `Distribution`, which could be anything that can be given to `sample`."

Concepts in Nim v2

2023-07-22 Thread TKD
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