News for hackers. Stuff that matters.
Re:Actually, you don't understand lexical scope by epidemian on Monday September 17, 2012 @10:13PM (#4535935)
Agreed. Maybe an example of how JavaScript/CoffeeScript would behave if it had dynamic scope semantics could help:

  // In dynamically scoped JS...
  var f = function() { alert a; }
  f(); // would throw an error as expected, but...
  var g = function() {
    var a = 5;
    f(); // would now work because `a` now exists.
  } // The scope of `a` ends here though, so...
  f(); // would throw again, but if we give life to the dinamically scoped `a` again...
  var a = 6;
  f(); // now works! Printing 6 as "expected" (at least after swallowing dynamic scope).
Re:Actually, you don't understand lexical scope by raganwald on Monday September 17, 2012 @11:35PM (#4536176)
From the vicious flame-fest that precipitated this post:

    x = 'lexical'

    acid = ->
      alert "#{x}ly scoped"

    test = (x) ->
      acid()
  
    test('dynamic')