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" object: type Texture = ref object ... AbstractRenderTarget = ref object {.inheritable.} ... Window = ref object ... proc setCurrentRenderTarget(t: AbstractRenderTarget) proc renderTargetWithTexture(t: Texture): AbstractRenderTarget = ... proc renderTargetWithWindow(w: Window): AbstractRenderTarget = ... ... var myTexture: Texture = ... setCurrentRenderTarget(renderTargetWithTexture(myTexture))
You could go a bit further and make renderTargetWithTexture and renderTargetWithWindow implicit converters, so that setRenderTarget is just: setRenderTarget(myTexture) # renderTargetWithTexture is called implicitly Such pattern usually allows for a nice decoupled design, although may be a bit problematic when you need to work with value types instead of reference types.