Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't get the part on package. Often you want to use structs. (Instance vs static)

How would you construct an instance in a test that needs mock implementations?



Such an instance would just be a variable somewhere that would be initialized in some init() call when the program starts. Every user of that instance will use it directly (as opposed to storing a reference to it locally DI style).


So global mutable state? How wonderfully modern!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: