title: Scala: the magic behind implicits
body: <p>I've been playing with "implicits" in Scala all weekend but I'm still having trouble grasping the whole concept. This question is based off of my <a href="https://stackoverflow.com/questions/24227585/scala-read-from-outside-in-instead-of-inside-out">previous one</a>. I decided to take things a step further with:</p>
  
  <pre><code>def a(b: String)(implicit c: () =&gt; String = () =&gt; "") = {
      println(s"$b - up next is "+c());c();b
  }
  
  implicit def conv(s: =&gt; String) = () =&gt; s
  </code></pre>
  
  <p>That's when things start to get a little whacky:</p>
  
  <pre><code>scala&gt; a("1")(a("2")(a("3")))
  3 - up next is 
  2 - up next is 3
  3 - up next is 
  1 - up next is 2
  3 - up next is 
  2 - up next is 3
  3 - up next is 
  </code></pre>
  
  <p>The basic idea here is to get each line to reference each other like so:</p>
  
  <pre><code>1
  2 from 1
  3 from 2
  4 from 3
  </code></pre>
  
  <hr>
  
  <ol>
  <li><p>Correct me if I'm wrong, but using implicit in this case will insert a string when one is found..? I'm not sure why it's printing out 7 lines instead of 3</p></li>
  <li><p>What am I doing wrong here? I'm starting to think that using implicits gives me less control</p></li>
  <li><p>Not as important, but is there a more safe way to go about implicits? A way that allows me to see exactly what's going on?</p></li>
  </ol>