title: Understanding complex block syntax
body: <p>I'm a beginner to Objective C and iOS development, but a 13-year .NET veteran.  I'm having a hard time mentally diagramming the following declaration, which came from the <a href="https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/WorkingwithBlocks/WorkingwithBlocks.html" rel="noreferrer">Programming with Objective C</a> guide:</p>
  <pre><code>void (^(^a)(void (^) (void))) (void) = ...
  </code></pre>
  <p>It's used as an example of why one should use <code>typedef</code> to define blocks, but I want to understand what I'm looking at to better get a feel for block definition syntax in the first place.</p>
  <p>Here's how I've diagrammed it so far:</p>
  <p><img src="https://i.stack.imgur.com/tc9jn.png" alt="enter image description here" /></p>
  <p>Where I'm running into problems is that here is how I understand the basic syntax:</p>
  <pre><code>[return_val] (^[block_name]) ([block_args]) = ...
  </code></pre>
  <p>If that's the case, then what I have is a block that returns void and has no arguments, but is named <code>(^a) (void (^) void)</code>.  Meaning the name of my block, rather than being a straight string, is itself a block.</p>
  <p>Clearly I'm missing something here.  Can someone please shed some light on it?  According to the site, it simplifies to this:</p>
  <pre><code>typedef void (^SimpleBlock) (void);
  SimpleBlock (^complexBlock) (SimpleBlock) = ...
  </code></pre>
  <p>I'm just missing how.</p>
  <p><em>Edit: The third void should have been in parentheses.  I fixed that.  It's wrong in the image, but I didn't feel like redoing the entire image just for that. :)  If it turns out to be the source of my problem, I will fix it here.</em></p>