title: Asynchronous callback flow control
body: <p>I'm looking to have better flow control for this async waterfall function.</p>
  
  <pre><code>async.waterfall([
    async.apply(osxAppIconName, options.appFile),
    function(iconFileName, callback) {
      var existingIcon = path.join(options.iconDirectory, iconFileName);
      return callback(null, existingIcon);
    },
    async.apply(fs.copy, options.iconFile), //automatically puts in existingIcon
    async.apply(osxAppIconTouch, options.appFile),
  ], callback);
  </code></pre>
  
  <p>Right now I'm using <code>async.apply</code> which will inject global function arguments. In this case above I'm good, it takes <code>existingIcon</code> and will add it as the second-to-last argument in <code>fs.copy</code>. Making <code>fs.copy</code>'s arguments <code>options.iconfile</code>, <code>exitingIcon</code>, callback <code>[function]</code>. Which is great!</p>
  
  <p>However, let's say I need exitingIcon later on. Let's say I push this into my waterfall functions array.</p>
  
  <pre><code>async.apply(newFunction, existingIcon)
  </code></pre>
  
  <p>How would I get <code>existingIcon</code> to this function? Globals? It seems like a headache to manage! I also think that the <code>async.apply</code> function is executing on load, so if I pass it a variable it's gonna use the value of the variable when <code>async.apply</code> executes.</p>
  
  <p>Thoughts? I have a proposal for <code>async.switchboard</code> <a href="https://github.com/caolan/async/issues/672" rel="nofollow">here</a>. Which attempts to solve this, but it doesn't work.</p>