Hello everyone. I'm learning Nim but I'm finding it difficult to implement some OOP software designs I have in mind. I see that Nim is a really flexible language that doesn't enforce the programmer to a particular programming paradigm/style (I may be wrong, but that's what I noticed while playing around with it). However I'm having trouble with the lack of multiple inheritance and/or interfaces...
I would like to make a concrete example hoping for someone to help me understand what would be an alternative way of implementing something like this in Nim. Let's consider a graphics library (maybe like SFML, strongly object oriented). There are drawable objects (text, rectangles, circles, sprites, etc...) and render targets (a window or a texture - so I can render off-screen to a framebuffer). So the first thing I'll need is some sort of "Drawable" base class/interface and a "RenderTarget" one (I'm strongly referencing SFML here). But then a lot of drawable objects (rectangles, circles, etc...) have in common the fact that they're a shape, and having a "Shape" base class would be pretty useful to recycle a lot of (OpenGL) code used to draw... shapes. But, as far as I can understand, there's not a simple, "native" way of having a Rectangle class inherit from Drawable and Shape. Also, as I mentioned, there are multiple render targets (for example the main window or textures). Even in this case, I would have to define a texture as being both a Drawable and a RenderTarget, but how would be the best way to do that? Please note that I'm not criticizing Nim by any means, in fact I've been using it various times in the last 2 years for various small projects and it's just an amazing language. I'm just asking for some advice/ideas on how to _cleanly_ implement such software architectures, since that has always been my major "trouble" with the language. Also I did various experiments (even with the example above) and I know there are some ways but I have never been satisfied with them (for various reasons). Without listing all the approaches I tried here, I would simply like for someone that is experienced with the language to directly point me out to the "right" way. Or, better said, to a "good" way, since I'm sure there are multiple ones given the flexibility of Nim. Thank you very much in advance, I hope this is not a "dumb" question.
