@Krux02
OK. If you're worried about code bloated, the best way is not to use interface,
try functional programming (object-oriented programming is inflexible):
import future
type
MyImplementationA = object
MyImplementationB = object
m_foo,m_bar: int
proc foo(this: MyImplementationA): int =
return 17
proc bar(this: MyImplementationA): int =
return 4
proc foo(this: MyImplementationB): int =
return this.m_foo
proc bar(this: MyImplementationB): int =
return this.m_bar
proc foobar(f: () -> int): int =
return f()
var a = MyImplementationA()
var b = MyImplementationB(m_foo: 32, m_bar: 8)
echo foobar(() => a.foo() + a.bar())
echo foobar(() => b.foo() + b.bar())