views:

173

answers:

1

In functional programming, functions are regarded as entities, and can be passed around as objects are in an OO context.

At some level, the function may be 'called' with some arguments.

And I was wondering: is this, too, called Dependency Injection?

And further: does this usage of DI result in Inversion of Control?

+4  A: 

Dependency Injection is a concept.

You could perhaps "implement" DI in functional languages using this (the ability to pass functions as parameters). There could be many ways to achieve DI and each language might have its ways of implementing DI.

DI is a specialized form of IoC. Thus all DI is IoC but not the other way round. So you are right in saying that this usage of DI results in IoC.

Sathya
Great answer, I was writing the exact thing, but your wording is so much better :)
Rene Saarsoo
Thanks. I guess your answer also confirms that DI is proper to OO?
xtofl