Nikolai Weibull <mailing-lists.ruby-talk / rawuncut.elitemail.org> writes: > OK. So Ruby has enough dependency-injection/inversion-of-control > libraries as it is, but mine is quite different so I figured I¡Çd post > it. It¡Çs about as simple as dependency-injection can possibly become > and there¡Çs no support for lifecycles, interception, or other framework > stuff. Nor is there any support for parents, children, or other > relatives, so keep it to yourself. Interesting idea, but you are only pushing constants around? Can't we do that easier? > class Scanner > def initialize(io) > raise Error, "can only work with open io-ports" if io.closed? > @io = io > end > end > class Error < ScriptError; end # Or something more creative, perhaps? Scanner::Error = Error > class TC_Driver < Test::Unit::TestCase > ãë¥ç > end > So the idea is that under normal circumstances, ¡Æneeds¡Ç is just a > circumvention for not using ¡Ærequire¡Ç directly, but for trying times the > dependency can be changed to something more suitable. I really fail to see the advantage of using this over manual require and dependency setting. :-) I personally would expect a DI framework to at least provide a singleton instantiation scheme, else it wouldn't make any sense to me at all. Einstein once said "Everything should be made as simple as possible, but not simpler". I think anything more simple than Matz-DI is too simple. > http://onestepback.org/articles/depinj/matz/index.html > nikolai -- Christian Neukirchen <chneukirchen / gmail.com> http://chneukirchen.org