is a CoffeeScript dialect that aims to be more radical and practical.
On its way to hide JavaScript's bad parts, CoffeeScript has accumulated own quirks: horrible variable scope, awkward ranges, confusing/pointless keywords, long extension, and so on. Coco tries to amend them, entwining good parts of both.
- Respect JavaScript/ECMAScript semantics.
- Die for DRY.
- Performance over readability.
- Perl over Ruby.
- Less keywords, punctuations and runtime errors.
on node.js
git clone git://github.com/satyr/coco.git && cd coco && bin/coke i
via npm
npm i coco
- Fixed coffee#1715 etc.
- Trivial improvements.
- Added unary assignments:
!! = x=>x = !!x - Made
a? <<< bshort fora <<< b if a?. - Improved stack traces from directly run .co files.
case/of/instanceofnow works better with array slice.instanceofnow rejects invalid right operands.
- Unary operators now spread into an array operand:
+[a, b]=>[+a, +b] ..now points to the constructor underclass.- coke now works from subdirectories. (coffee#1687)
- Added pipe operator:
f! => g _=>_ = f!; g _ - Fixed identifier lexing as per ES5.
- Improved label handlings.
- Helper functions are now declared last. (coffee#1638)
- Added character ranges:
[\a to \d]=>[\a \b \c \d] - Added named destructuring:
{p, q}:o = f!=>o = f!; {p, q} = o - Numbers can no longer start with
.. functioncan no longer prefix->/~>. Use~functionto declare bound functions instead.
- Allowed line folding after
forprepositions. importing onto a soaked expression is now safe.--jsonnow modifies--astor--compile.- Fixed #81 etc.
- Added soak assign.
- Added
<?and>?operators. - Loops can now have
elseclause. import xis now short forthis <<< x.,after(,[or another,now impliesvoid.
- Added object slice.
- Added bang call:
f!=>f() - Revised clone syntax from
x{}to^x. - Revised semiautovivification syntax from
.!/.@to.@/.@@. - Variable interpolations no longer require braces:
"(#id)"=>"(" + id + ")" - Spaced dots now close implicit calls. See coffee#1407.
- Direct calls to
supernow delegatethis. extendedhook is back.fromofforis now optional, meaningfrom 0.tillessfromis no longer allowed.
while/untilcan now have update clause after test clause:continue while f(), g()=>for (; f(); g()) {}thatno longer triggers anaphoric conversion underunless/until.- Disallowed
a.=b = cp:~ (a, b) ->f ..., aetc. - Fixed coffee#1416.
- Added
do-while/untilconstruction. - Added
$flag to regexes. Same as.source, but more efficient. - Suppressed implicit return on
newed/setter functions. - Sped up lexer.
- Added
!?(inexistence) operator. functionno longer requires parens around parameters.classblock is now mandatory.- Bug fixes: coffee#1352 coffee#1354
a.b.c?.=d.enow works as expected.a[b, c] = dnow works as expected.- extras/coco.js works again on WSH.
--outputimplies--compileagain.
- Added
**operator. - Overloaded
+/-//(in addition to*) for arrays and strings. - Revised
let:let (a) ~>=>let a then - Allowed underscores within number literals.
- Major regex changes:
- Dieted heregex:
/// re ///=>// re // - Allowed leading whitespace in normal regex literals when unambiguous.
- No longer accepts invalid regexes.
- Dieted heregex:
->is now optional whenfunctionis used.caseaccepts comma-separated tests again.return/throwcan now take a block.- REPL now uses ^J to continue lines.
- Enabled:
- ADI on
?. - ACI on
++/-- - conditional destructuring assignments
- colors and tab completion in REPL
- ADI on
- Made leading
*s serve like list markers.
- Added string/array multiplication.
- Added label support.
- Aliased
constructoras...
- Added
let. Unarydois back at being simple call. - Added
with. - Added semiautovivification.
- Made
::a pure sugar forprototype, which can now directly refer to@::under class body. ?.can now appear anywhere a normal dot can be used.~.is changed to. ~.newno longer accepts splatted arguments.--interactivenow works with--compileand--bare.- Renamed
--nodesoption and.nodesmethod to--ast/.ast. - Fixed the performance bug wrt long method chains.
- Quit supporting node.js 0.3.x or lower.
- Unrestricted ADI for identifiers beyond
@and::. - Expanded property shorthands beyond
@foo. - Added
typeof!, which inspects the internal [[Class]] property. - Added shebang support.
- REPL results now evaluate more intuitively.
- Disallowed whitespace mixup for indentations.
debuggernow works anywhere.- Revised heregex flag syntax:
///#{x}#{y}///?->RegExp('' + x, y); - Removed
Coco.eval. - Made extras/coco.js work as a mini-compiler on WSH.
- Added extras/mode-coco.js, an editing mode for Ace.
- Added
--jsonoption.
- Added backcall, a sugar to flatten nested callbacks.
doblock can now work as a pair of normal parentheses.- Improved ACI (automatic comma insertion):
f {} [] x->f({}, [], x); - Improved ADI (automatic dot insertion):
@@0'!'->arguments[0]['!']; - Multiline block on the RHS of object property now works as an implicit array.
- Heregexes now support dynamic flags:
/// x #{? y } ///->RegExp('x', y); - Enabled compound accessigns:
a.+=b->a += a.b; ...in array destructuring (same as...[]) now skips items rather thansliceing them. (coffee#870)- Compilation errors now report line numbers.
Cocoobject now emits more events for use with--require.
->=>~>->&.~.- Braceless objects no longer consume property shorthands. (coffee#618)
- Indentations within non-here strings are now stripped.
- Fixed
block comment syntax to good ol'
/* */. @0is nowthis[0]rather thanarguments[0].
is notis the newisnt.@'++'is now valid as a shorthand for@['++'].- Commas between primitive values are now optional.
- coke now automatically aliases tasks.
- extras/coco.js now works as a Gecko JS Module.
- Grouped documentation suite into doc/ for portability.
- Rewrote src/optparse.co.
- Added numeric ranges.
- Destructuring assignments can now specify default values using logical operators.
Default arguments syntax has been changed accordingly.
(
(a || b) ->instead of(a ||= b) ->) donow performs special conversions against function literals with parameters, making it work as pseudo-letand Coffee 1.0.0 compliant.- Allowed
for i from x thenas a sugar forfor i from 0 til x then. - Disallowed duplicate formal arguments.
- Improved syntax-highlight in src/index.html.
- Version bump for Xmas, in concert with Coffee 1.0.0.
@@is now a shorthand forarguments.docan now indicate a call against indented arguments.andandornow close implicit calls, making you write even less parens:f x and g y or z->f(x) && g(y) || z;catch's variable declaration is no longer required.a<[ b c ]>is now equivalent toa[\b, \c](wasa(\b, \c)).casenow requires brackets to have multiple conditions.- Added
--nodejsoption. See coffee#910. - Renamed
--stdioto--stdin.
- Added character/word literal:
\C + \++->'C' + '++'; - Retrieving multiple properties at once is now possible:
a[b, c]->[a[b], a[c]]; - Destructuring into an object's properties is now possible:
a[b, c] = d->a[b] = d[0], a[c] = d[1];a{b, c} = d->a.b = d.b, a.c = d.c;
- Compound assignments can now destructure:
[@a, @b] /= c->this.a /= c[0], this.b /= c[1];
- Conditional control structures can now be anaphoric;
thatwithinif,whileorcaseblock now refers to the condition value. - Decimal numbers can now have arbitrary trailing alphabets as comments.
e.g.
9times,1.5s - Added
<<</<<<<as aliases toimport/import all - non-ASCII identifiers are now allowed.
.and its families can now be used with numbers and strings, instead of[].a.0.'0'compiles toa[0]['0'].- Added syntax for cloning objects;
obj{key:val}acts like a simple version of ES5Object.create, creating a prototypal child ofobjand assigning to.keywithval. - default arguments can now choose to use
||/&&. superunder a class block now refers to the superclass.- .coffee extension is no longer supported.
- 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
--nodesoutput.
...is now prefix.{0: first, (*-1): last} = arraynow works.- Added
--lexto thecocoutility. Removed--lint. - src/ now has doc view.
Release.