This page is no longer maintained — Please continue to the home page at

Fwd: Re: Dependency Injection

No replies
Kris Nuttycombe
Joined: 2009-01-16,
User offline. Last seen 42 years 45 weeks ago.
Oops, forgot reply-all. Again.
2011/9/16 Tony Morris <tonymorris [at] gmail [dot] com>
On 16/09/11 20:08, √iktor Ҡlang wrote:
>> Have you tried something like that:
>> import java.lang.ThreadLocal
>> class Parameter[A](initial:  A) {
>>     val tl = new ThreadLocal[A] {
>>         override def initialValue() : A = {
>>             initial
>>         }
>>       }
>>     def apply() = tl.get()
>>     def withValue[B](a : A, p : => B){
>>        val old = tl.get()
>>        tl.set(a)
>>        try{
>>            p
>>          }
>>        finally{tl.set(old)}
>>     }
>> }
> Not that I don't like inventing wheels, but what's wrong with:

Was I really that unclear?

Tony Morris

Hi, Tony,
Unfortunately, I think some of us *really really* need to see an example of the approach you're suggesting. I've seen you talk about it at least half a dozen times in various threads, and have never been able to figure out how to apply the solution you're suggesting. So please, please give an example like Russ requested!
From my perspective, the future of configuration lies in FRP. A reactive model is the only one that will allow you to safely make changes not merely at compile or load time, but at runtime where whole pieces of your system may need to be reloaded based upon a change to configuration. 

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland