Re:Nim Community Survey 2019 Results
by dom96 on Monday February 24, 2020 @07:28AM
(#22403467)
I would say that this is in some ways by design. Nim offers some OOP features, but in general does its best to discourage the use of OOP. In that sense I would say you should skip OOP and implement everything in a procedural style (it will be more efficient too).
[ Parent
| on HN ]
The only OOP-ish thing I've really missed in nim is interfaces. It seems to be a really convenient way to re-use code: "this function (proc) can operate on any type that has implementations of this and that other function (proc)".
Googling has left me with suggestions of using macros to re-implement similar functionality, which I guess is in line with nim's philosophy of "small core with powerful macro system". Looking into it however, developing macros seems like more effort than a simple interface.
Just the impressions of someone not super familiar with metaprogramming.
The idea I think is that someone needs to implement it using macros and get it into Nim's stdlib. Then we can all make use of it. If you're passionate enough about interfaces then you may just be able to implement something that works beautifully and get it merged into stdlib (that would be awesome).