title: Accessing self from instance properties which are closures
body: <p>I'm using Xcode6-beta2, but I've had the same issue since the very first public beta. My Swift subclass of Obj-C UIViewController looks like this:</p>
  
  <pre><code>class SomeVC: UIViewController {
      var c1: () -&gt; () = {
          println(self)
      }
  
      var c2: () -&gt; () {
          get {
              return { println(self) }
          }
      }
  
      var c3: () -&gt; () {
          return { println(self) }
      }
  
      override func viewDidAppear(animated: Bool) {
          super.viewDidAppear(animated)
          c1()
          c2()
          c3()
      }
  }
  </code></pre>
  
  <p>When the VC is shown, I see the following lines printed out:</p>
  
  <pre><code>(Function)
  &lt;_TtC12SwiftiOSTest6SomeVC: 0x10bf1ed10&gt;
  &lt;_TtC12SwiftiOSTest6SomeVC: 0x10bf1ed10&gt;
  </code></pre>
  
  <p>(c2 and c3 differ only in that it is not necessary to include the get {...} for a computed property if it is only gettable.)</p>
  
  <p>So, the first closure's <strong>self</strong> seems to refer to the function/closure type itself, whereas the other ones' <strong>self</strong> refer to the view controller (as I would expect).
  The only difference between c1 and c2/c3 is that the former is a stored property, the latter are computed properties, but I would still expect the closures and their captured values be the same, i.e. <strong>self</strong> to always refer to the enclosing class. The way things are now, there seems to be no obvious way for the <strong>c1</strong> closure to access methods / properties of the enclosing class.</p>
  
  <p>Is this something documented somewhere (I read the Swift book and didn't find anything), or is it just a beta-compiler bug of some kind, which should be filed somewhere?</p>