Skip to content
satyr edited this page Mar 14, 2011 · 25 revisions

behavior

  • Assigning to a variable with = declares it on the current scope. Use := to modify variables declared on upper scopes.
  • ===/!==/==/!= each compiles as is.
  • super represents the direct reference to the parent function rather than being a call. Use super ... (just super in Coffee) for full delegation.
  • Nested comprehensions return flattened results.
  • Within non-triple-quoted strings (''/""), newlines and indentations that follow them are ignored.

keyword

  • The roles of in and of have been swapped to keep the JS semantics.
  • yes/no/on/off are unreserved. Define your own or just use true/false.
  • switch-case-default replaces switch-when-else.
  • for ever replaces loop.
  • is not replaces isnt.
  • void replaces undefined.
  • ~> replaces =>.
  • when is removed. Use a if b while c instead of a while c when b.
  • it/that/fallthrough are semi-reserved. They get special meanings depending on context.
  • eval/arguments are keywords as per ES5.

grammar

  • () is always a call. f () -> means f()(->) (compile error in Coffee).
  • ... is prefix as per harmony:spread.
  • and/or close implicit calls. f a or f b means f(a) || f(b).
  • The range syntax (x..y) is removed.
  • ?[ is removed in favor of the generalized form ?.[ (or ?.().
  • Block comment is /* */ rather than ### ###.

other

  • CLIs are named coco and coke (to coexist with coffee and cake).
  • JavaScriptLint support is removed (for being pointless).
Clone this wiki locally