Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Schmonference 2012: Introducing "CoffeeScript II: The Wrath of Khan"

Schmonference 2012: Introducing "CoffeeScript II: The Wrath of Khan"

88d24101a5653f4b98c363c6a05acc6a?s=128

Michael Ficarra

June 29, 2012
Tweet

Transcript

  1. Michael Ficarra Schmonference 2012 CoffeeScript II: The Wrath of Khan

  2. None
  3. None
  4. THIS GUY

  5. http://kck.st/HDNjnC

  6. http://arborjs.org/halfviz/#/MjU3Mw

  7. None
  8. advantages • standardised intermediate representations • more powerful parser •

    better error reports • forces consistent indentation ▪ and allows a consistent base indentation, useful for compiling copied sections of code • two-pass variable naming • specify output formatting • line mappings
  9. None
  10. advantages • standardised intermediate representations • more powerful parser •

    better error reports • forces consistent indentation ▪ and allows a consistent base indentation, useful for compiling copied sections of code • two-pass variable naming • specify output formatting • line mappings
  11. None
  12. None
  13. None
  14. advantages • standardised intermediate representations • more powerful parser •

    better error reports • forces consistent indentation ▪ and allows a consistent base indentation, useful for compiling copied sections of code • two-pass variable naming • specify output formatting • line mappings
  15. None
  16. advantages • standardised intermediate representations • more powerful parser •

    better error reports • forces consistent indentation ▪ and allows a consistent base indentation, useful for compiling copied sections of code • two-pass variable naming • specify output formatting • line mappings
  17. advantages: tooling • automatic code formatting in editor • syntax

    highlighter • code coverage • static analysis tools ▪ dead code detection ▪ cyclomatic complexity ▪ reassignment warnings ▪ detecting non-idiomatic style (linting)
  18. None
  19. and now for something completely different

  20. let-expressions do ($ = jQuery) -> ... (function($){ ... })(jQuery)

  21. not in, not of, not instanceof a not in b

    a not of b a not instanceof b [].indexOf.call(b, a) < 0 !(a in b) !(a instanceof b)
  22. anonymous classes fn class then method: -> fn((function() { function

    _Class() {} _Class.prototype.m = function() {}; return _Class; })());
  23. switch on truthiness switch when a then b switch (false)

    { case !a: b; }
  24. destructuring everywhere a for {prop: a} in b var a,

    _i, _len; for (_i = 0; _i < b.length; _i++) { a = b[_i].prop; a; }
  25. destructuring everywhere ({prop: a}) -> (function(_arg) { var a; a

    = _arg.prop; });
  26. semicolon is seq operator a = (fn(); b) var a;

    a = (fn(), b);
  27. binary number literals 0b1001100110111 0x1337

  28. follow the project on twitter @CSatGRPN https://twitter.com/CSatGRPN

  29. None