title: Strange iterpritation coffeescript to javascript. Why?
body: <p>I'm performing get request in coffee script:</p>
  
  <pre><code>parseRequest = (line) -&gt;
       try
         request = JSON.parse(line)
       catch err
       try
      switch request.method
          when 'authorize'
              req = http.get { port: 8080, path: "/test/config" }, (res) -&gt;
              console.log "Get response: #{res.statusCode}"
              res.on 'data', (chunk) -&gt; 
                  console.log('body: ' + chunk)
                  request.params[0] = JSON.parse(chunk).config.username
                  console.log "Request: " + request.params[0]
                  request.params[1] = JSON.parse(chunk).config.password
                  console.log "Request: " + request.params[1]
                  line = JSON.stringify(request)
                  console.log "Changed username and pass to: #{request.params[0]},#{request.params[1]}"
                  ......{lot of code}.........
                  return line
  </code></pre>
  
  <p>In output I get this:</p>
  
  <pre><code> Changed username and pass to: original,p
   Get response: 200
   body: {"config":{"username":"newuser","password":"newpass"}}
   Request: newuser
   Request: newpass
  </code></pre>
  
  <p>So last log message output first and in result of function, that is store in 'line', still contains old values. Of course, I try a lot of different variants, in attempts to fix this problem, but get no luck. Then I decide to look at compiled javascript based on this coffee script. I see this:</p>
  
  <pre><code>req = http.get({
      port: 8080,
      path: "/test/config"
  }, function(res) {
      console.log("Get response: " + res.statusCode);
      return res.on('data', function(chunk) {
          console.log('body: ' + chunk);
          request.params[0] = JSON.parse(chunk).config.username;
          console.log("Request: " + request.params[0]);
          request.params[1] = JSON.parse(chunk).config.password;
          return console.log("Request: " + request.params[1]);
       });
   });
   line = JSON.stringify(request);
   console.log("Changed username and pass to: " + request.params[0] + "," + request.params[1]);
  </code></pre>
  
  <p>In java script last two lines, was moved out of scope function on('data'), that's why I recive last output in first line, and that's why variable line contains old values. But why coffee script translate my script to such javascript code? Something connected with visibility of variable line? How can I fix it and get what I excpected in coffeescript?  </p>