[erlang-questions] Beginner Question: Spring-like IOC in erlang

Todd Greenwood-Geer t.greenwoodgeer@REDACTED
Wed Apr 13 21:44:23 CEST 2011

1. Is there an idiomatic way to use dependency injection in erlang?

Most of my use of Spring DI has been to facilitate injection of test 
classes into a stack for functional testing. Is this sort of thing done 
in erlang?

2. How about AOP style join-points for before and after execution around 
a method?

As an example, wouldn't it be cool to dynamically enable debug or trace 
level logging for an application when a certain error threshold is 
reached? Then, when the system returns to a normal state, the error 
logging could be turned back down... I think I might start doing this in 
the Java stacks I'm currently working with (log4j).

3. Is there a way to intercept messages to a process? This is the real 
question... Say a process dies unexpectedly and OTP restarts it... it 
would be cool to be able to dynamically proxy messages to a process that 
has exceeded some error threshold. The proxy could log them, or perform 
more intensive error analysis... Then, once the system is back in a 
normal state, the proxy could be removed from the message loop chain.


More information about the erlang-questions mailing list