Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Unfancy CoffeeScript

License

NotificationsYou must be signed in to change notification settings

seanjensengrey/coco

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

is aCoffeeScript dialectthat aims to be more radical and practical.

Why

On its way to hide JavaScript's bad parts, CoffeeScript has accumulated own quirks:horrible variable scope,awkward ranges,confusingand/orpointlesskeywords, verbose file extension,and so on.Coco tries to amend them, entwining good parts of both.

Principles

  • Respect JS semantics and idioms.
  • Die forDRY.
  • Perl over Ruby.
  • Fewer keywords, punctuations and runtime errors.

Differences

Documents

Installation

GetNode.js andnpm, then:

  • npm i -g coco
  • git clone git://github.com/satyr/coco.git && cd coco && bin/coke i

Changelog

0.9.1

  • Addedif-block. (#151)
  • Addedfor-let. (#164)
  • Added<> akalef. (#180)
  • Gave|> the lowest precedence.
  • Made block constructions directly dot-accessible.
  • Made JS literal Markdown-esque. To include N`, close with N+1`:``` '``' ```
  • Quit reusing temporary variables.
  • File extensions likeco.json,coon, orcocoon now imply--json.
  • Fixed:

0.9.0

  • Literal& is now used to reference several new targets:
    • Left hand of|> (in place of_).
    • Current item of newly added quick map:for [0 1] => &+2 # [2 3]
    • Subject of newwith as proposedin#172.
  • Made cascade, nowwith in disguise, require at least one& in body.(#179)
  • Madelet acceptthis = on the first assignment to substitute oldwith.
  • Made bodylesscatch return the catchee.
  • Madeby -1 implied on downward ranges.
  • Made interpolation apply to#& and#@.
  • Quit expandingsuper followed by:: to parent method,so that call tosuper::anotherMethod works as expected.
  • Fixed:

0.8.2

0.8.1

0.8.0

  • Allowed hyphenated alphabets within identifiers as alias to their upper case:encode-URI-component =>encodeURIComponent
  • Added cascade. (#72
  • Changed the pipe operator to|>.
  • Revised=> as another block creation operator.
  • export/import/const/var can now appear anywhere.
  • catched variables are now function-scoped.(coffee#2422)
  • Generated variables now get postfix$ rather than prefix__.

0.7.6

  • Addedexport const.
  • Enabled object splat within brace objects via...:.
  • Allowed array repetition to work on slices and comprehensions.
  • Disallowed malformed hex/unicode escape sequence in string.
  • Quit overloading+ for array concatenation.
  • class can be bodyless again.
  • super no longer auto-.calls more than once.

0.7.5

  • Implementedimplements. (#144)
  • Top-levelvoids are now simply ignored and usable like Python'spass.

0.7.4

  • Addedimport declaration in place of the implicitthis import:import a, b =>this <<< a <<< b
  • Madesuper work in accessor methods.
  • Disallowed redeclarations viavar.
  • Improved handling of nonexistent files.

0.7.3

  • Node.js 0.8.x.
  • Addedconst andvar. (#139)
  • Madefunction variables read-only.
  • Removed-n shorthand for--nodejs.(#142)
  • Bug fixes:
    • super with nested classes and methods
    • f a, while b then c etc.
    • and others:#138#141#143

0.7.2

  • Revised accessor. (#5)
  • Allowed implicit array after some unary operators.
  • Added named backcall:<-:f g =>g(:f ->)
  • Made{[q]:p} short for{p: [q]:p}.

0.7.1

  • Addedexport statement. (#121)
  • Made{{q}:p} short for{p: {q}:p}.
  • Allowed keyword literals as object shorthand:{true} =>{true: true}
  • Allowed decimals and$ in number comments.
  • Removed uppercase radix prefixes and exponential notation as percoffee#2061.
  • Labelling a function (literal or IIFE sugar) now names it.E.g.:f -> compiles to(function f(){}).
  • super call to a bound class now works as expected.
  • All compiler-generated variables are now double-underscore prefixed.
  • --interactive no longer implies--bare.Use-bi when you want top-level variables to persist.

0.7.0

  • Caught up Node.js 0.6.x.
  • ! against function/backcall now suppresses its auto-return.
  • superclass now points to the constructor that theclass extends.
  • super now relies solely onsuperclass rather than requiring special forms likeC::m = ->.
  • of no longer delegates toArray::indexOf, making it consistent withfor-of behavior.
  • Inline implicit objects now close at newline orif/for/while/until.
  • --print no longer implies--compile.
  • --watch now works on Windows.

0.6.7

0.6.6

  • Added unary assignments:!! = x =>x = !!x
  • Madea? <<< b short fora <<< b if a?.
  • Improved stack traces from directly run .co files.

0.6.5

  • case/of/instanceof now works better with array slice.
  • instanceof now rejects invalid right operands.

0.6.4

  • 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)

0.6.3

  • Added pipe operator:f! => g _ =>_ = f!; g _
  • Fixed identifier lexing as per ES5.
  • Improved label handlings.
  • Helper functions are now declared last.(coffee#1638)

0.6.2

  • 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..
  • function can no longer prefix->/~>.Use~function to declare bound functions instead.

0.6.1

  • Allowed line folding afterfor prepositions.
  • importing onto a soaked expression is now safe.
  • --json now modifies--ast or--compile.
  • Fixed#81 etc.

0.6.0

Additions

Changes

  • Addedobject slice.
  • Added bang call:f! =>f()
  • Revised clone syntax fromx{} to^x.
  • Revised semiautovivification syntax from.!/.@ to.@/.@@.
  • Variable interpolations no longer require braces:"(#id)" =>"(" + id + ")"
  • Spaced dots now close implicit calls.Seecoffee#1407.
  • Direct calls tosuper now delegatethis.
  • extended hook is back.
  • from offor is now optional, meaningfrom 0.tillessfrom is no longer allowed.

0.5.4

  • while/until can now have update clause after test clause:continue while f(), g() =>for (; f(); g()) {}
  • that no longer triggers anaphoric conversion underunless/until.
  • Disalloweda.=b = cp:~ (a, b) ->f ..., a etc.
  • Fixedcoffee#1416.

0.5.3

  • Addeddo-while/until construction.
  • Added$ flag to regexes. Same as.source, but more efficient.
  • Suppressed implicit return onnewed/setter functions.
  • Sped up lexer.

0.5.2

  • Added!? (inexistence) operator.
  • function no longer requires parens around parameters.
  • class block is now mandatory.
  • Bug fixes:coffee#1352coffee#1354

0.5.1

  • a.b.c?.=d.e now works as expected.
  • a[b, c] = d now works as expected.
  • extras/coco.js works again on WSH.
  • --output implies--compile again.

0.5.0

  • Added** operator.
  • Overloaded+/-// (in addition to*) for arrays and strings.
  • Revisedlet: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.
  • -> is now optional whenfunction is used.
  • case accepts comma-separated tests again.
  • return/throw can now take a block.
  • REPL now uses^J to continue lines.

0.4.2

  • Enabled:
    • ADI on?.
    • ACI on++/--
    • conditional destructuring assignments
    • colors and tab completion in REPL
  • Made leading*s serve like list markers.

0.4.1

  • Added string/array multiplication.
  • Added label support.
  • Aliasedconstructor as...

0.4.0

  • Addedlet. Unarydo is back at being simple call.
  • Addedwith.
  • 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. ~.
  • new no longer accepts splatted arguments.
  • --interactive now works with--compile and--bare.
  • Renamed--nodes option and.nodes method to--ast/.ast.
  • Fixedthe performance bug wrt long method chains.
  • Quit supporting Node.js 0.3.x or lower.

0.3.2

  • Unrestricted ADI for identifiers beyond@ and::.
  • Expanded property shorthands beyond@foo.
  • Addedtypeof!, which inspects the internal[[Class]] property.
  • Added shebang support.
  • REPL results now evaluate more intuitively.
  • Disallowed whitespace mixup for indentations.

0.3.1

  • debugger now works anywhere.
  • Revised heregex flag syntax:///#{x}#{y}///? ->RegExp('' + x, y);
  • RemovedCoco.eval.
  • Madeextras/coco.js work as a mini-compiler on WSH.
  • Addedextras/mode-coco.js, an editing mode forAce.
  • Added--json option.

0.3.0

Pure Additions

  • Addedbackcall, a sugar to flatten nested callbacks.
  • do block can now work as a pair of normal parentheses.
  • ImprovedACI (automatic comma insertion):f {} [] x ->f({}, [], x);
  • ImprovedADI (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 compoundaccessigns:a.+=b ->a += a.b;
  • ... in array destructuring (same as...[]) now skips items rather thansliceing them. (coffee#870)
  • Compilation errors now report line numbers.
  • Coco object now emits more events for use with--require.

Incompatible Changes

  • => ->~>
  • &. ->~.
  • Braceless objects no longer consume property shorthands.(coffee#618)
  • Indentations within non-here strings are now stripped.
  • Fixedblock comment syntax to good ol'/* */.
  • @0 is nowthis[0] rather thanarguments[0].

0.2.2

  • is not is 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 intodoc/ for portability.
  • Rewrotesrc/optparse.co.

0.2.1

  • 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) ->)
  • do now performs special conversions against function literals with parameters,making it work as pseudo-let and Coffee 1.0.0 compliant.
  • Allowedfor i from x then as a sugar forfor i from 0 til x then.
  • Disallowed duplicate formal arguments.
  • Improved syntax-highlight insrc/index.html.

0.2.0

  • Version bump for Xmas, in concert withCoffee 1.0.0.
  • @@ is now a shorthand forarguments.
  • do can now indicate a call against indented arguments.
  • and andor now 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)).
  • case now requires brackets to have multiple conditions.
  • Added--nodejs option. Seecoffee#910.
  • Renamed--stdio to--stdin.

0.1.6

  • 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];

0.1.5

  • Conditional control structures can now be anaphoric;that withinif,while orcase block 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.

0.1.4

  • . 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 ofobj and assigning to.key withval.
  • 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 thecoco utility. Removed--lint.
  • src/ now hasdoc view.

0.1.1

Release.

Packages

No packages published

Languages

  • JavaScript99.4%
  • CSS0.6%

[8]ページ先頭

©2009-2025 Movatter.jp