dhughes/CoolBeans — Issue #1: Perhaps parse dependency names instead of relying on parameter order?
Author: karlbohlmark
Created: 2011-12-17 11:32:42+00:00
State: open

I like his initiative, it's pretty much what I was looking for. (Even though I can't help thinking I'm doing smth wrong since nobody seems to use ioc in the node community)

However, it's unfortunate that you have to specify constructor args by position instead of by type, as you would in a statically typed language. But since we can't rely on types here we have two possibilities.

Either we consider the dependencies ordered and make sure the ordering in the constructor corresponds to the wiring, or we parse the constructor arg names from the function and consider them to be bean names.

The benefit of the latter approach would be that most stuff could be autowired. On the con side we would have to do some funky magic string parsing of functions.

What do you think?