News for hackers. Stuff that matters.
Re:The worst thing about CoffeeScript by mattdeboard on Saturday January 25, 2014 @12:42PM (#7121468)
``print a``? The inner `a` is the same reference as the outer `a`.

  a = 1;

  def foo(): b = a; return b

  foo() is a

  >> True
This gets hairy when referring to mutable types:

  a = []

  def foo(): b = a; return b

  foo().append(1)

  a

  >> [3]
Compare to immutable types:

  c = ()

  def bar(): d = c; return d

  bar() + (1,)

  c

  >> ()
Re:The worst thing about CoffeeScript by agumonkey on Saturday January 25, 2014 @12:55PM (#7121544)
I understand the context, but isn't it unfair to compare `append` and `+` ? Python is not clojure or sml, I think people assume mutability, and using foo() + [1] will consistently build fresh objects in both cases.
Re:The worst thing about CoffeeScript by mattdeboard on Sunday January 26, 2014 @09:45PM (#7128416)
No, I don't think it's unfair because "fairness" has nothing to do with anything.

I was simply illustrating how using a mutable data structure defined in an outer scope can bite you.

Re:The worst thing about CoffeeScript by agumonkey on Monday January 27, 2014 @09:16AM (#7130348)
Fair enough. May I mention the default parameter bite too. It's hard to notice at first.