Hacker News new | ask | show | jobs
by ratStallion 1781 days ago
#2 is interesting...can you give an example solving circular dependencies? Even if you had an interface, wouldn't you still have the implementations still causing a circular dependency?
1 comments

You can turn A->B, B->A into A->I,B->A + A.I=B and that does avoid a circular dependency.

A->B means a depends on B, A->I means A depends on an interface, and A.I=B means that B is set as the implementation of the I interface that A depends on.

I’m on mobile so that was the best I could come up with. Try it out using Swift though, and that can be translated pretty directly.