Comment

Comment by nickcw

In my opinion, not allowing circular dependencies is a great design choice for building large programs. It forces you to separate your concerns properly.

If you get a circular dependency something is wrong with your design and the article does a good job on how to fix them.

I sometimes use function pointers which other packages override to fix circular dependencies which I don't think was mentioned in the article.

My only wish is that the go compiler gave more helpful output when you make a circular dependency. Currently it gives a list of all the packages involved in the loop which can be quite long, though generally it is the last thing you changed which caused the problem.

parent nickcw 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton