{"id":8734,"date":"2017-02-27T10:14:22","date_gmt":"2017-02-27T01:14:22","guid":{"rendered":"http:\/\/sitest.jp\/blog\/?p=8734"},"modified":"2017-02-27T10:15:40","modified_gmt":"2017-02-27T01:15:40","slug":"coffeescript%e3%81%8c%e5%b8%b0%e3%81%a3%e3%81%a6%e3%81%8d%e3%81%9f-2-0-0-alpha%e3%83%aa%e3%83%aa%e3%83%bc%e3%82%b9%e3%81%a7es2015es6%e3%81%ab%e5%af%be%e5%bf%9c","status":"publish","type":"post","link":"https:\/\/sitest.jp\/blog\/?p=8734","title":{"rendered":"CoffeeScript\u304c\u5e30\u3063\u3066\u304d\u305f! 2.0.0-alpha\u30ea\u30ea\u30fc\u30b9\u3067ES2015(ES6)\u306b\u5bfe\u5fdc"},"content":{"rendered":"<p>\u307f\u306a\u3055\u3093\u3001CoffeeScript\u306f\u597d\u304d\u3067\u3059\u304b\uff1f<\/p>\n<p>\u305d\u308c\u307e\u3067(ES3,ES5)\u306eJavaScript\u306b\u6bd4\u3079\u3066\u5727\u5012\u7684\u306b\u30b7\u30f3\u30d7\u30eb\u3067\u5206\u304b\u308a\u3084\u3059\u3044\u8a18\u6cd5\u306b\u3088\u308a\u5927\u4eba\u6c17\u3068\u306a\u3063\u305fAltJS\u3067\u3059\u304c\u3001ES2015\u4ee5\u964d\u306e\u300c\u6a19\u6e96\u300dJavaScript\u306b\u305d\u306e\u8a18\u6cd5\u306e\u591a\u304f\u304c\u53d6\u308a\u5165\u308c\u3089\u308c\u3001\u512a\u4f4d\u6027\u304c\u8584\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u307e\u305f\u3001\u9759\u7684\u578b\u4ed8\u3051\u304c\u53ef\u80fd\u306aTypeScript\u306e\u53f0\u982d\u306a\u3069\u304c\u3042\u308a\u3001\u6700\u8fd1\u3042\u307e\u308a\u540d\u524d\u3092\u805e\u304b\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u3057\u304b\u3057\u3001{}\u3092\u4f7f\u308f\u305a\u3001\u30a4\u30f3\u30c7\u30f3\u30c8\u3067\u30d6\u30ed\u30c3\u30af\u3092\u5b9a\u7fa9\u3059\u308b\u30b7\u30f3\u30d7\u30eb\u306a\u8a18\u6cd5\u306a\u3069\u3001ES2015\u4ee5\u964d\u306b\u53d6\u308a\u3053\u307e\u308c\u3066\u3044\u306a\u3044CoffeeScript\u306e\u5229\u70b9\u306f\u307e\u3060\u307e\u3060\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u30a4\u30f3\u30c7\u30f3\u30c8\u3067\u306e\u30d6\u30ed\u30c3\u30af\u5b9a\u7fa9\u306f\u5b9f\u88c5\u304c\u96e3\u3057\u304f\u3001\u51e6\u7406\u7cfb\u306e\u4e71\u7acb\u3059\u308bJavaScript\u306e\u6a19\u6e96\u306b\u306f\u306a\u308a\u305d\u3046\u306b\u3042\u308a\u307e\u305b\u3093\u3002\u306a\u306e\u3067\u3001\u79c1\u306fCoffeeScript\u304c\u5927\u597d\u304d\u3067\u3059!<\/p>\n<p>\u3067\u3059\u304b\u3089\u3001ES2015\u4ee5\u964d\u306b\u5bfe\u5fdc\u3057\u305f\u65b0\u3057\u3044CoffeeScript\u306e\u767b\u5834\u3092\u5f85\u3063\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u5148\u65e5\u3001\u3064\u3044\u306bGitHub\u4e0a\u306b\u6b21\u306e\u3088\u3046\u306a\u30ea\u30ea\u30fc\u30b9\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>Progress as of February 2017: 2.0.0-alpha1!<br \/>\n<a href=\"https:\/\/github.com\/coffeescript6\/discuss\/issues\/71\" target=\"_blank\" rel=\"nofollow\">https:\/\/github.com\/coffeescript6\/discuss\/issues\/71<\/a><\/p>\n<p>CoffeeScript2.0.0!<br \/>\n\u3053\u306e\u6642\u3092\u5f85\u3063\u3066\u3044\u305f\uff01<\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\n\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n<\/h3>\n<\/div>\n<p>\u65e9\u901f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u3059!<\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30b3\u30de\u30f3\u30c9\u306f\u4e0a\u8a18\u8a18\u4e8b\u3067\u306f\u30aa\u30d7\u30b7\u30e7\u30f3\u306a\u3057\u3067<\/p>\n<pre>\n<code class=\"lang-bash\">\n$ npm install coffeescript@next\n<\/code>\n<\/pre>\n<p>\u7d39\u4ecb\u3055\u308c\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u3069\u306e\u307f\u3061<\/p>\n<pre>\n<code class=\"lang-bash\">\nnpm WARN prefer global coffeescript@2.0.0-alpha1 should be installed with -g\n<\/code>\n<\/pre>\n<p>\u3068\u8b66\u544a\u304c\u3067\u308b\u306e\u3067\u3001\u30b0\u30ed\u30fc\u30d0\u30eb\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002(coffee\u30b3\u30de\u30f3\u30c9\u304c\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u4e0a\u66f8\u304d\u3055\u308c\u308b\u306e\u3067\u3001\u3042\u307e\u308a\u304a\u3059\u3059\u3081\u306f\u3057\u307e\u305b\u3093\u304c\u2026)<\/p>\n<pre>\n<code class=\"lang-bash\">\n$ npm install coffeescript@next -g\n(\u4e2d\u7565)\n\/Users\/xxx\/.nodebrew\/node\/v5.10.1\/lib\n\u2514\u2500\u2500 coffeescript@2.0.0-alpha1\n<\/code>\n<\/pre>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u307e\u3057\u305f!(\u4ed6\u306e\u958b\u767a\u7528\u306b\u53e4\u3044node\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u2026\u76f4\u5f8c\u306b\u66f8\u304d\u307e\u3059\u304c\u3001\u3053\u308c\u304c\u539f\u56e0\u3067\u30a8\u30e9\u30fc\u304c\u304a\u3053\u308a\u307e\u3057\u305f\u3002)<\/p>\n<p><a href=\"http:\/\/coffeescript.org\/\" target=\"_blank\" rel=\"nofollow\">\u516c\u5f0f\u30b5\u30a4\u30c8<\/a>\u304b\u3089\u65e7\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u30b5\u30f3\u30d7\u30eb\u30bd\u30fc\u30b9(Classes, Inheritance, and Super\u306e\u8aac\u660e\u306e\u3068\u3053\u308d\u3067\u3059\u3002)<br \/>\n\u3092\u62dd\u501f\u3057\u3066 test.coffee\u3068\u3044\u3046\u540d\u524d\u3067\u4fdd\u5b58\u3057\u307e\u3059\u3002(alert\u306fconcole.log\u306b\u5909\u66f4\u3057\u307e\u3057\u305f)<\/p>\n<pre>\n<code class=\"lang-javascript\">\nclass Animal\n  constructor: (@name) ->\n\n  move: (meters) ->\n    console.log @name + \" moved #{meters}m.\"\n\nclass Snake extends Animal\n  move: ->\n    console.log \"Slithering...\"\n    super 5\n\nclass Horse extends Animal\n  move: ->\n    console.log \"Galloping...\"\n    super 45\n\nsam = new Snake \"Sammy the Python\"\ntom = new Horse \"Tommy the Palomino\"\n\nsam.move()\ntom.move()\n\n<\/code>\n<\/pre>\n<p>\u559c\u3073\u52c7\u3093\u3067\u30b3\u30f3\u30d1\u30a4\u30eb!<\/p>\n<pre>\n<code class=\"lang-bash\">\n$ coffee -c test.coffee\n<\/code>\n<\/pre>\n<p>\u3057\u304b\u3057\u3001\u52d5\u304b\u306a\u3044\u3002<br \/>\nNode\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u53e4\u304f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u5f15\u6570\u304c\u4f7f\u3048\u306a\u3044\u306e\u3067\u6012\u3089\u308c\u3066\u3057\u307e\u3044\u307e\u3057\u305f<\/p>\n<pre>\n<code class=\"lang-bash\">\nSyntaxError: Unexpected token =\n    at exports.runInThisContext (vm.js:53:16)\n    at Module._compile (module.js:387:25)\n    at Object.Module._extensions..js (module.js:422:10)\n    at Module.load (module.js:357:32)\n    at Function.Module._load (module.js:314:12)\n    at Module.require (module.js:367:17)\n    at require (internal\/module.js:16:19)\n    at Object.<anonymous> (\/Users\/xxx\/.nodebrew\/node\/v5.10.1\/lib\/node_modules\/coffeescript\/bin\/coffee:7:1)\n    at Module._compile (module.js:413:34)\n    at Object.Module._extensions..js (module.js:422:10)\n<\/code>\n<\/pre>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\nNode.js\u6700\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u3084\u3063\u3066\u307f\u308b<br \/>\n<\/h3>\n<\/div>\n<p>\u304a\u3068\u306a\u3057\u304fNode\u306e\u6700\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u4f7f\u3044\u307e\u3059\u2026<\/p>\n<pre>\n<code class=\"lang-bash\">\n$ nodebrew use latest\nuse v7.6.0\n<\/code>\n<\/pre>\n<p>\u6c17\u3092\u53d6\u308a\u76f4\u3057\u3066\u3082\u3046\u4e00\u5ea6!<\/p>\n<pre>\n<code class=\"lang-bash\">\n$ coffee -c test.coffee\n$\n<\/code>\n<\/pre>\n<p>\u30b3\u30f3\u30d1\u30a4\u30eb\u3067\u304d\u307e\u3057\u305f\uff01\u7d50\u679c\u306f\u3053\u3061\u3089<\/p>\n<pre>\n<code class=\"lang-javascript\">\n\/\/ Generated by CoffeeScript 2.0.0-alpha1\n(function() {\n  var Animal, Horse, Snake, sam, tom;\n\n  Animal = class Animal {\n    constructor(name) {\n      this.name = name;\n    }\n\n    move(meters) {\n      return console.log(this.name + ` moved ${meters}m.`);\n    }\n\n  };\n\n  Snake = class Snake extends Animal {\n    move() {\n      console.log(\"Slithering...\");\n      return super.move(5);\n    }\n\n  };\n\n  Horse = class Horse extends Animal {\n    move() {\n      console.log(\"Galloping...\");\n      return super.move(45);\n    }\n\n  };\n\n  sam = new Snake(\"Sammy the Python\");\n\n  tom = new Horse(\"Tommy the Palomino\");\n\n  sam.move();\n\n  tom.move();\n\n}).call(this);\n<\/code>\n<\/pre>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\n\u5909\u63db\u5f8c\u306e\u30bd\u30fc\u30b9\u304c\u8aad\u307f\u3084\u3059\u3044!<br \/>\n<\/h3>\n<\/div>\n<p>\u3000\u3053\u308c\u307e\u3067\u3060\u3063\u305f\u3089\u3001class \u306f prototype\u3092\u4f7f\u3063\u3066\u8868\u73fe\u3057\u305f\u308a\u3001extend\u306f\u5c02\u7528\u306e\u95a2\u6570\u3092\u7528\u3044\u305f\u308a\u3068\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u5f8c\u306e\u30bd\u30fc\u30b9\u306f\u5fc5\u305a\u3057\u3082\u53ef\u8aad\u6027\u304c\u3088\u304f\u306f\u306a\u304f\u3001\u30c7\u30d0\u30c3\u30b0\u304c\u96e3\u3057\u304b\u3063\u305f\u306e\u3067\u3059\u304c<\/p>\n<p>\u3000\u4eca\u56de\u304b\u3089ES2015\u4ee5\u964d\u306e class \u8a18\u6cd5\u3092\u7528\u3044\u3066\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u5f8c\u306e\u30bd\u30fc\u30b9\u3082\u5206\u304b\u308a\u3084\u3059\u3044\u3082\u306e\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u306f\u5b09\u3057\u3044\u3002\u3042\u3068\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30ea\u30c6\u30e9\u30eb\u3082\u3001\u305d\u306e\u307e\u307eES2015\u306e\u3082\u306e\u304c\u51fa\u529b\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30b3\u30f3\u30d1\u30a4\u30eb\u5f8c\u306eES2015\u4ee5\u964d\u306e\u8a18\u8ff0\u30b9\u30bf\u30a4\u30eb\u306b\u306a\u308b\u306e\u3067\u3001\u6b8b\u5ff5\u306a\u304c\u3089\u3001\u65e7CoffeeScript\u3068\u306e\u4f75\u7528\u306f\u3067\u304d\u306a\u304f\u306a\u308a\u305d\u3046\u3067\u3059\u304c\u3001\u300cES2015+\u300d\u300cCoffeeScript\u300d\u306e\u3044\u3044\u3068\u3053\u308d\u53d6\u308a\u304c\u3067\u304d\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>function\u306ffunction\u306e\u307e\u307e\u3067\u3001\u30a2\u30ed\u30fc\u6f14\u7b97\u5b50(=>)\u306b\u306f\u7f6e\u304d\u63db\u308f\u3089\u308c\u306a\u3044\u3088\u3046\u3067\u3059\u3002\u5168\u90e8\u7f6e\u304d\u63db\u3048\u308c\u3070\u3044\u3044\u3068\u3044\u3046\u3082\u306e\u3067\u3082\u7121\u3044\u306e\u3067\u3044\u3044\u306e\u3067\u3059\u304c\u2026\u96e3\u3057\u3044\u3068\u3053\u308d\u3067\u3059\u3002<\/p>\n<p>\u6bd4\u8f03\u7528\u306b\u3001\u65e7CoffeeScript\u3067\u751f\u6210\u3055\u308c\u305f\u30bd\u30fc\u30b9\u3082\u63b2\u8f09\u3044\u305f\u3057\u307e\u3059\u3002\u3084\u3063\u3071\u308a\u8aad\u307f\u3065\u3089\u3044\u2026<\/p>\n<pre>\n<code class=\"lang-javascript\">\nvar Animal, Horse, Snake, sam, tom,\n  extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n  hasProp = {}.hasOwnProperty;\n\nAnimal = (function() {\n  function Animal(name) {\n    this.name = name;\n  }\n\n  Animal.prototype.move = function(meters) {\n    return console.log(this.name + (\" moved \" + meters + \"m.\"));\n  };\n\n  return Animal;\n\n})();\n\nSnake = (function(superClass) {\n  extend(Snake, superClass);\n\n  function Snake() {\n    return Snake.__super__.constructor.apply(this, arguments);\n  }\n\n  Snake.prototype.move = function() {\n    console.log(\"Slithering...\");\n    return Snake.__super__.move.call(this, 5);\n  };\n\n  return Snake;\n\n})(Animal);\n\nHorse = (function(superClass) {\n  extend(Horse, superClass);\n\n  function Horse() {\n    return Horse.__super__.constructor.apply(this, arguments);\n  }\n\n  Horse.prototype.move = function() {\n    console.log(\"Galloping...\");\n    return Horse.__super__.move.call(this, 45);\n  };\n\n  return Horse;\n\n})(Animal);\n\nsam = new Snake(\"Sammy the Python\");\n\ntom = new Horse(\"Tommy the Palomino\");\n\nsam.move();\n\ntom.move();\n<\/code>\n<\/pre>\n<p>ES2015\u4ee5\u964d\u306e\u75d2\u3044\u3068\u3053\u308d\u306b\u624b\u304c\u5c4a\u304fCoffeeScript 2.0\u3002 \u03b1\u7248\u306a\u306e\u3067\u3001\u30d7\u30ed\u30c0\u30af\u30c8\u306b\u306f\u4f7f\u3048\u307e\u305b\u3093\u304c\u65e9\u901f\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u3067\u4f7f\u3063\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002\u305d\u308c\u3067\u306f\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u307f\u306a\u3055\u3093\u3001CoffeeScript\u306f\u597d\u304d\u3067\u3059\u304b\uff1f \u305d\u308c\u307e\u3067(ES3,ES5)\u306eJavaScript\u306b\u6bd4\u3079\u3066\u5727\u5012\u7684\u306b\u30b7\u30f3\u30d7\u30eb\u3067\u5206\u304b\u308a\u3084\u3059\u3044\u8a18\u6cd5\u306b\u3088\u308a\u5927\u4eba\u6c17\u3068\u306a\u3063\u305fAltJS\u3067\u3059\u304c\u3001ES2015\u4ee5\u964d\u306e\u300c\u6a19\u6e96\u300dJavaScript\u306b\u305d\u306e\u8a18\u6cd5\u306e\u591a\u304f\u304c\u53d6\u308a\u5165\u308c\u3089\u308c\u3001\u512a\u4f4d\u6027\u304c\u8584\u308c\u307e\u3057\u305f\u3002 \u307e\u305f\u3001\u9759\u7684\u578b\u4ed8\u3051\u304c\u53ef\u80fd\u306aTypeScript\u306e\u53f0\u982d\u306a\u3069\u304c\u3042\u308a\u3001\u6700\u8fd1\u3042\u307e\u308a\u540d\u524d\u3092\u805e\u304b\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"author":1,"featured_media":8780,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[51,37,36,27],"tags":[],"acf":false,"_links":{"self":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts\/8734"}],"collection":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/comments?post=8734"}],"version-history":[{"count":16,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts\/8734\/revisions"}],"predecessor-version":[{"id":8810,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts\/8734\/revisions\/8810"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/media\/8780"}],"wp:attachment":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/media?parent=8734"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/categories?post=8734"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/tags?post=8734"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}