News for hackers. Stuff that matters.
Re:Modern Functional Programming: The Onion Architecture by hota_mazi on Thursday September 29, 2016 @02:27PM (#12607639)
> First of all, passing parameters in functions is "dependency injection". And what you're describing is a really good thing.

It's only injection if the parameter is passed automatically by a framework. Otherwise, it's parameter passing.

And it's only a good thing if you value referential transparency over ease of testing and encapsulation. Not everybody does (and personally, sometimes I do and sometimes I don't).

Re:Modern Functional Programming: The Onion Architecture by bad_user on Thursday September 29, 2016 @02:36PM (#12607732)
Dude you're mixing up terms. Quoting from https://en.wikipedia.org/wiki/Dependency_injection : "A dependency is an object that can be used (a service). An injection is the passing of a dependency to a dependent object (a client) that would use it". Basically if A depends on B, but A does not initialize B, but is instead receiving it as a parameter from somewhere, then that's dependency injection.

> it's only a good thing if you value referential transparency over ease of testing and encapsulation

I get the feeling that you're mixing up terms again, as you cannot have ease of testing or good encapsulation without referential transparency.

Re:Modern Functional Programming: The Onion Architecture by 20andup on Thursday September 29, 2016 @10:53PM (#12610282)
"passing parameters in functions is 'dependency injection'"

No, its not.

Re:Modern Functional Programming: The Onion Architecture by hota_mazi on Friday September 30, 2016 @01:24AM (#12610650)
You're agreeing with me.

I was saying that passing parameters to functions is "dependency passing", not "dependency injection".