On Monday, 5 January 2015 at 01:21:07 UTC, Vlad Levenfeld wrote:
Could you elaborate on the difference between D's templates/mixins and Nim's macros/type classes?

I'd suggest you read the available documentation on each feature; for example Nim's user defined type classes are described here

http://nim-lang.org/manual.html#user-defined-type-classes

and the Nim's templates/macros are also described with examples in the manual. One caveat is that user defined type classes are not really useable now and will probably be feature gated (not removed as some other poster here suggested) so it's not fair to talk about them as though they actually exist now. They're more like multiple alias this or D's precise GC ;-). D templates (what is called generics in Nim) are more powerful than Nim generics. Maybe Nim will pick up some of those features (HKTs are a desired feature in Rust and maybe in Nim too) and maybe not.

It's really difficult to compare languages and features. Like I said, pick a small project and write some code in each. I found Nim really easy to pick up for small projects; a bit easier than D and much easier than Rust, which I like, but find slow going.

Reply via email to