他の言語をある程度知っている人はこれを読めばD言語の基礎をマスターでき,D言語の氷山の一角くらいは知ることができると思います.対象バージョンはdmd 2.059です.
ASCIIかUTFしか受け付けません.それ以外の文字コードで書くとコンパイルエラーになります.
D言語のmainはCとは違い以下のようなシグネチャです.
"^ " | |
=~ ( | |
("(").("~"^"."^"^"^(""=="")."").("^" | |
^"="^(""=="").""^")").("^"^".").("=" | |
^"~"^(""=="")."").("("^(""=="^").""^ | |
"."^"^").("("^(""=="").""^"^"^")").( | |
(" ^( " | |
== " | |
") . | |
"" ^ |
require 'formula' | |
class Gauche < Formula | |
url 'http://downloads.sourceforge.net/gauche/Gauche/Gauche-0.9.1.tgz' | |
homepage 'http://practical-scheme.net/gauche/' | |
md5 '6134e9c16aef2bc9fd3fa7e8fbebdd10' | |
def install | |
system "./configure", |
import qualified Control.Monad.State as S | |
import qualified Data.Map as M | |
import Control.Monad.Error () | |
data AST = Node [AST] | Leaf Value | |
instance Show AST where | |
show (Node xs) = "(" ++ unwords (map show xs) ++ ")" | |
show (Leaf v) = show v | |
data Value = IntVal Int | Define String AST |
import qualified VM as V | |
import qualified Text.Parsec as P | |
import Control.Applicative ((<|>), (<$>)) | |
import qualified Control.Monad.State as S | |
import qualified Data.Map as M | |
import Data.Maybe (fromJust) | |
data Intermediate = Comment String | |
| Inst V.Instruction | |
| Paramdef String |
apply()
, call()
の理解が足りない。function Class (bar) { | |
this.foo = bar; | |
} | |
Class.prototype.method = function () { | |
return this.foo; | |
}; | |
var instance = new Class('baz'), | |
func = instance.method; |
Original: "Callbacks are imperative, promises are functional: Node's biggest missed opportunity" by James Coglan
Translated by Yuta Okamoto (@okapies)