Hacker News new | past | comments | ask | show | jobs | submit login

Despite its linkbait title, this is one of the more thoughtful pieces on CoffeeScript that I've seen in a while. The behavior of nested list comprehensions in CoffeeScript has been the subject of much debate, and the excellent Coco fork adopts the Python-esque behavior.

However, I think the objections here would be moot if CoffeeScript's "list comprehensions" were called something else. They don't behave like list comprehensions in Python, but their behavior is perfectly consistent with the CoffeeScript philosophy that every expression has a value, and loops are expressions. That means that a single loop has a single list as its value, and a loop within a loop produces a list of lists. Note that unlike Python—or Harmony—there's no special delimiter to say "Give me a list comprehension." It's just the natural implication of how expressions in CoffeeScript work.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: