この記事は Crystal Advent Calendar 2015 の 15 日目の記事です
昨日は Kemal の開発者である sdogruyol さんの記事でした。
今日は、私 pine613 が次の Crystal 勉強会の告知記事を書きます!
- 2016年1月22日 (金) に Cookpad さんで開催決定
この記事は Crystal Advent Calendar 2015 の 15 日目の記事です
昨日は Kemal の開発者である sdogruyol さんの記事でした。
今日は、私 pine613 が次の Crystal 勉強会の告知記事を書きます!
Goals:
Most developers would agree that, all other things being equal, a synchronous program is easier to work with than an asynchronous one. The logic for this is pretty clear: one flow of execution is easier for the human mind to simulate than n concurrent flows.
After doing two small projects in node.js (one of which is here -- ready for the blinding flurry of criticism), there's one question that I can't shake: if asynchronicity is an optimization (that is, a complexity introduced for the sake of performance), why would people, a priori, turn to a framework that imposes it for everything? If asynchronous code is harder to reason about, why would we elect to live in a world where it is the default?
It could be argued pretty well that the browser is a domain that inherently lends itself to an async model, but I'd be very curious to hear a defense of "async-first" thinking for problems that are typically solved on the server-side. When working with node, I've noticed
Node.js is just JavaScript running on the server side. That's it. That's all there is to it.
| set :application, "My Static Content" | |
| set :servername, 'test.example.com' | |
| # no git? simply deploy a directory | |
| set :scm, :none | |
| set :repository, "." # the directory to deploy | |
| # using git? deploy from local git repository | |
| # set :scm, :git | |
| # set :repository, 'file//.' # path to local git repository |
| require "big_int" | |
| def fact(n) | |
| return 1 if n == 0 | |
| n * fact(n - 1) | |
| end | |
| n = BigInt.new(ARGV[0]) | |
| puts fact(n) |
| require "http/server" | |
| module HTTPCluster | |
| struct Worker | |
| def initialize(@pid : Int32, @master : Int32) | |
| end | |
| def call(port) | |
| yield(port) | |
| end |