Skip to content
superjoe30 edited this page Oct 4, 2012 · 25 revisions

behavior

  • = to a variable declares it on the current scope. Use := to modify ones on upper scopes.
  • ===/!==/==/!= each compiles as is.
  • super represents the direct reference to the parent function rather than being a call itself. Use super ... (just super in Coffee) for full delegation.
  • Nested comprehensions return flattened results.
  • Within non-triple-quoted strings (''/""), indentations after newlines are ignored altogether.
  • do does not specialcase function literals. Use let instead.
  • \ does not introduce a pseudo block. It simply cancels following whitespaces.

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.
  • ~> (wavy arrow) replaces => (fat arrow).
  • 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; allowing f (), disallowing () ->.
  • ... is prefix as per harmony:spread.
  • and/or and spaced ./?. close implicit calls. f a .g b or h c means f(a).g(b) || h(c).
  • The range syntax (x..y) is removed.
  • Block comment is /* */ rather than ### ###.
  • Heregex is // // rather than /// ///.
  • No implicit call against blocks starting with an implicit object. Use do instead:
    array.push do
      a: 1
      b: 2
    
  • a-b desugars to aB instead of a - b
  • "#variable" === '' + variable instead of "#variable" === '#variable'

other

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