Hacker News new | ask | show | jobs
by ars 1255 days ago
Or just create two versions of the constructor - one that takes the arg, and one that doesn't.

The one that doesn't does whatever magic you were planning for the DI, does that, then calls the constructor with the arg.

1 comments

Planning magic isn't necessary! What if your class requires a new dependency?