3 ms·
I like the nim language, but the lack of interfaces has been a bit of a turn-off for me. Do nim programmers not see the need for abstracting out behavior in a
by zareith 6mo ago
I like the nim language, but the lack of interfaces has been a bit of a turn-off for me.
Do nim programmers not see the need for abstracting out behavior in a manner that different implementations can be switched somewhere else, or is there different idiomatic way to handle this?
- tinfoilhatter 6mo agoNim doesn't have interfaces, but concepts + parametric polymorphism gets you a long way - https://jasonbeetham.ca/writeups/codereuse.html https://jasonbeetham.ca/writeups/codereuse.html
- nick__m 6mo agoThe concepts feature of Nim really looks like what your looking for https://nim-lang.org/docs/manual.html#concepts https://nim-lang.org/docs/manual.html#concepts
- moigagoo 6mo agoWe use custom types for that usually, optionally with parametric polymorphism. But as others said already, Nimony (codename for the next Nim iteration) introduces revamped concepts which should be even more convenient.