title: Explanation of weak self assignment using __typeof
body: <p>I found an odd line of code in the REActivityViewController project on GitHub and cannot understand it. It appears to avoid casting the value to the exact class that it is declared as, but I do not know why that would be necessary. I wonder if it is somehow important for inheritance.</p>
  
  <p>Can anyone explain why this would be done?</p>
  
  <pre><code>__typeof(&amp;*self) __weak weakSelf = self;
  </code></pre>
  
  <p><a href="https://github.com/romaonthego/REActivityViewController/blob/master/REActivityViewController/REPocketActivity.m" rel="nofollow">https://github.com/romaonthego/REActivityViewController/blob/master/REActivityViewController/REPocketActivity.m</a></p>
  
  <p>I'd make this more clear by declaring it this way...</p>
  
  <pre><code>id __weak weakSelf = self;
  </code></pre>
  
  <p>And then within the block I can redeclare it as a strong reference.</p>
  
  <pre><code>REPocketActivity* __strong strongSelf = (REPocketActivity*)weakSelf;
  </code></pre>
  
  <p>Then I would use <code>strongSelf</code> within the block. When it goes out of scope it drops the strong reference safely.</p>