title: In scala, how to extract the value within a DynamicVariable?
body: <p>I found a question about DynamicVariable: </p>
  
  <p><a href="https://stackoverflow.com/questions/5116352/when-we-should-use-scala-util-dynamicvariable">When we should use scala.util.DynamicVariable?</a></p>
  
  <p>Then I tried to make an example to use the <code>DynamicVariable</code></p>
  
  <pre><code>object m {
  
    class W {
      def wrapper[T](f: =&gt; T) = W.dyn.withValue("Bye")(f)
    }
  
    object W {
      private val dyn = new DynamicVariable[String]("Hello")
    }
  
    def main() = {
      val w = new W()
      w.wrapper {
        println(1)
      }
    }
   }
  m.main()
  </code></pre>
  
  <p>It compiles successfully, but I have no ideas about how to extract the value assigned by the <code>DynamicVariable</code>, does anyone have ideas about this?</p>