Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Unfancy CoffeeScript
JavaScript

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
extras
lib
src
test
.gitignore
Cokefile
LICENSE
README.md
coco.png
index.html
package.json

README.md

Coco

is a CoffeeScript dialect that aims to be more radical and practical.

Principles

  • Respect JavaScript/ECMAScript semantics, but supply ways to amend them.
  • Performance over readability.
  • Readability over compressability.
  • Die for DRY.
  • Reserve less keywords.

Features

Incompatibilities

behavior

  • Assigning to a variable with = declares it on the current scope. Use := to modify variables declared on upper scopes.
  • The roles of in and of have been swapped to keep the JS semantics.
  • ===/!==/==/!= each compiles as is.
  • ... is prefix.
  • super represents the direct reference to the parent function rather than being a call. Use super ... (just super in Coffee) for a simple delegation.
  • Nested comprehensions returns flattened results.

keyword

  • yes/no/on/off are not reserved. Define your own or just use true/false.
  • undefined is not reserved.
  • switch-case-default replaces switch-when-else.
  • for ever replaces loop.
  • when is removed. Write a if b while c instead of a while c when b.

other

  • The binaries are named coco and coke to coexist with coffee and cake.

Installation

Install node.js, then

git clone git:github.com/satyr/coco.git && cd coco && bin/coke install

Or install npm, then

npm install coco

Help

coco -h; coke

Changelog

0.1.4

  • . and its families can now be used with numbers and strings, instead of []. a.0.'0' compiles to a[0]['0'].
  • Added syntax for cloning objects; obj{key:val} acts like a simple version of ES5 Object.create, creating a prototypal child of obj and assigning to .key with val.
  • default arguments can now choose to use ||/&&.
  • super under a class block now refers to the superclass.
  • .coffee extension is no longer supported.

0.1.3

  • Compilation now prefers single quotes.
  • AST now compiles faster, roughly 1.4 times than 0.1.2.
  • []/{} can now be safely used as an placeholder within array destructuring.
  • Improved --nodes output.

0.1.2

  • ... is now prefix.
  • {0: first, (*-1): last} = array now works.
  • Added --lex to the coco utility. Removed --lint.
  • src/ now has doc view.

0.1.1

Release.

Something went wrong with that request. Please try again.