r/programming • • Jul 25 '13

CoffeeScript's Scoping is Madness

http://donatstudios.com/CoffeeScript-Madness
207 Upvotes

315 comments sorted by

View all comments

Show parent comment

4

u/masklinn Jul 26 '13 edited Jul 26 '13

To be fair, CoffeeScript most likely had an effect on the design of Dart, Typescript, and the upcoming versions of JS.

IIRC, C#'s lambda expression predate CS's by 2 years and they're almost identical (the biggest difference is that CS has two different "arrows" for capturing the current this or not). And Scala — which again has almost identical lambda syntax) predates C# 3.0 by ~4 more years.

And its syntax looks a lot (though it's not identical to) Haskell's, whose 1.0 definition predates Scala by 13 years.

CoffeeScript (2009): (x, y) -> expr(x, y) or (x, y) => expr(x, y)
C# 3.0 (2007): (x, y) => expr(x, y)
Scala (2003): (x, y) => expr(x, y) (also shorthand along the lines of expr(_, _), not verified)
Haskell (1990): \x y -> expr x y

edit: fixed Haskell lambda, uses -> not =>

1

u/oantolin Jul 26 '13

The Haskell one should have -> instead of =>.

1

u/masklinn Jul 26 '13

Indeed, fixed. Sorry about that.