title: Use `self` as a default parameter
body: <p>Can I use <code>self</code> as a default parameter in Swift? This code feels pretty straight forward but I don't understand the message the compiler is kicking back:</p>
  
  <pre><code>func printTree(node: TreeNode = self, tabs: String = "") {
    println(tabs + node.name!)
    node.children.forEach { printTree(node: $0, tabs: tabs+"\t") }
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>'TreeNode -&gt; () -&gt; TreeNode' is not convertible to 'TreeNode'
  </code></pre>
  
  <p>Huh?</p>
  
  <p>There are probably other ways I could solve the tree traversal but I'm actually just curious about the default parameter restriction. Is this a real thing? Is there a mention of this in the docs? I couldn't find one.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I did this from scratch with no dependencies (I had a class heirarchy and a custom <code>forEach</code> monkey patch involved before). It still errors:</p>
  
  <pre><code>class PeanutButterJelly {
    var children: [PeanutButterJelly]?
    func doDance(){ println("dancing") }
    func everybodyDanceNow(pbj: PeanutButterJelly = self) {
      pbj.doDance()
      if let children = pbj.children {
        for child in children { child.doDance() }
      }
    }
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Swift compilation error: unresolved identifier 'self'
  </code></pre>
  
  <p>Xcode 6.3.2</p>