Re: Advice on OOP in Nim

2018-01-12 Thread jzakiya
Ruby is a fully OOP language but doesn't have multiple inheritance either. Every class is open though (you can add/change methods in them), and you can create the equivalence of multiple inheritance by using **modules** and **mixins** where you **include** them in **classes** to extend them.

Re: Advice on OOP in Nim

2018-01-12 Thread yglukhov
Please, feel free to ask anything, I'll try my best to answer. Note though, that that's only my opinion As for a good read, nothing comes to mind atm. But generally, since you're asking about OOP in terms of graphics, I would suggest sacrificing OOP, as well as composition-over-inheritance,

Re: Advice on OOP in Nim

2018-01-12 Thread gdelazzari
That was really helpful, I'll look into a similar approach and I'll try to apply these suggestions to other designs I'll have to implement. I see that the problem is definitely my way of thinking about the project structure/architecture (which is no surprise given I have a C++ background). I

Re: Advice on OOP in Nim

2018-01-12 Thread yglukhov
> But does that mean I'll have to allocate a new AbstractRenderTarget on the > heap Yes. Or you could just return something already cached within the respective Texture/Window objects to make it high load friendly. As a side note, your suggested API makes the user believe there's no price for

Re: Advice on OOP in Nim

2018-01-12 Thread yglukhov
I don't know the right answer to your problem. However note that a lot of languages do not support multiple inheritance for a good reason (outside the scope of this question), so how would you use those? A working pattern for me is the following: create an interface to your "multi-interface"

Advice on OOP in Nim

2018-01-12 Thread gdelazzari
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