4 ms·
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
by auxym 7y ago
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.
- dom96 7y agoThe 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).