Created
April 23, 2010 12:40
-
-
Save tyru/376501 to your computer and use it in GitHub Desktop.
Zimbu introduction - translation in Japanese
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
もしあなたが新しいプログラム、例えばテキストエディタを作るとしたら、どの言語で作る? | |
Suppose you want to write a new program, something like a text editor. What language would you write it in? | |
* できるだけ速く。なのでインタプリタ言語はダメ。 | |
* It has to be as fast as possible, so interpreted languages are out. | |
* ちまちまメモリ管理なんてしたくない。だからCはダメ。 | |
* You don't want to micro manage memory, so C is out. | |
* プログラマに学位をとれなんて言いたくない。だからC++はダメ。 | |
* You don't want to require programmers to have a degree, so C++ is out. | |
* できるだけ起動は速いほうがいいし、ランタイムには依存させたくない。だからJavaはダメ。 | |
* You want fast startup and not depend on a big runtime, so Java is out. | |
* できるだけクロスプラットフォーム間で動かしたい。だからDはダメ。 | |
* It has to run on most systems, anything with a C compiler, so D is out. | |
* 何か新しいものを作るなら楽しんでやりたいよね。 | |
* You want to have fun making something new. | |
既存の言語は完全にこれらの要求には答えてくれない。 | |
だから新しい言語を作ってしまおう。 | |
No existing language really meets these demands, so let's create a new one that does. | |
Zimbuは実験的なプログラミング言語だ。 | |
こいつはとても実用的な言語で、無意味な言語の類とは違う。 既存の言語の良いところを受け継ぎ、それらの不満を解決する。 そして多少は新しい特徴をつけた。 | |
Zimbu is an experimental programming language. It is a very practical, no-nonsense kind of language. It mixes the good things of many existing languages and avoids their deficiencies. And then throws in a few brand new ideas. | |
* 保守のし易さ - コードは書かれた時の何倍もの回数読まれるものだ。 | |
* easy to read back - code is read N times more often than it is written | |
* ありがちなミスを避けよう - まずいコードを書くのを難しくしよう (しかし「ハック」を書きたいのなら書けるように) | |
* avoid common mistakes - make it difficult to write bad code (but you can write hacks if you really want to) | |
* 短く簡潔に、同じことを2回やるな - ヘッダファイルはないし、型指定も繰り返さない | |
* keep it short and clear, don't state the same thing twice - no header files, don't repeat type specs | |
* 式の影響は予測可能であるべきで、他のファイルの何かに依存するべきではない | |
* the effect of a statement should be predictable and not depend on something in another file | |
* 効率的な実行: 起動時の遅延はなく、省メモリ - Just In Timeコンパイラに影響されたりGCで"stop the world"することもない | |
* efficient execution: no startup delay, reasonable memory use - no Just In Time compiler effects or "stop the world" garbage collection. | |
* 幅広い範囲に応用できる - ZimbuはOSのカーネルも書けるし、ちょっとしたスクリプトから大きなGUIアプリケーションまで書ける | |
* support a wide range of applications - Zimbu can be used to write an OS kernel, a short script and a big GUI application | |
* ポータブル - ほとんどの環境でコンパイル可能 | |
* portable - be able to compile and run on almost any system | |
* 多くの標準データ型、モジュール、クラス - あなたが求めたものはほとんどそこにある | |
* many standard data types, modules and classes - most things you need are already there | |
Choices | |
Main choices made so far (more on the design page): | |
* プログラムをCに変換し、Cコンパイラで使機械語を出力 (いずれ機械語以外の出力形式に対応するかも) | |
* convert the program to C and use the C compiler to produce machine code (could be something else later) | |
* ほとんどの場合は静的な型チェックを行うが、必要に応じて動的な型チェックも | |
* mostly use static type checking, also allow runtime type checking | |
* オブジェクト指向風、全てのデータはオブジェクトのように扱える、しかし単純な型もある | |
* object oriented, all data is handled like an object, but there also are simple types | |
* 1つのimportは1つだけシンボルを定義する、これは大きなプロジェクトにおける名前の衝突を避けるため | |
* an import defines one symbol, this avoids name conflicts in large projects | |
* 標準モジュールやクラスはインポートすることなく使える、退屈な仕事はなくそう | |
* the standard modules and classes are available without imports, avoids boring work | |
* 多くのモジュールが言語に含まれており、どの環境でも同じように使える | |
* many modules are part of the language, they work the same way everywhere | |
* 全てのキーワードは大文字、次のバージョンであなたのプログラムが動かなくなるといった心配をする必要はない | |
* all keywords are in capitals, you can use all other names without worrying about the next version breaking your program | |
Zimbuを使ってみたいでしょ? | |
Want to try out Zimbu? | |
code.google.com/p/zimbu で Mercurial レポジトリをクローンするかスナップショットをダウンロード | |
Download a snapshot or clone the Mercurial repository from | |
code.google.com/p/zimbu | |
つかいかたは Getting Started ページを見てね。 | |
For instructions see the Getting Started page. | |
Zimbu の話題に参加したい? | |
Want to discuss Zimbu? | |
メーリングリストはこちら: | |
The mailist is here: http://groups.google.com/group/zimbu-discuss | |
Examples | |
Hello World program: hello.zu: | |
FUNC int MAIN() | |
IO.write("Hello, World!\n") | |
RETURN 0 | |
} | |
Notes: | |
* プログラムへのエントリーポイントはMAIN()である | |
* The entry point to the program is the MAIN() function. | |
* キーワードは全て大文字である、これはあなたが名前を決めるとき予約後を知る必要はないということ。また既存のZimbuプログラムを動かなくさせることなく、後で予約後を追加といったことも可能である | |
* Keywords are in capitals, this avoids the problem that you need to know all keywords when picking a name. And it allows for adding keywords later without breaking any existing Zimbu program. | |
* IOモジュールは入出力処理を含む。IO.write()は標準出力への出力。IO.stdout.write()も同じだ。Zimbuの流儀はよく使うコードはいつも短く済ますこと。でも長いやり方も一貫性のために存在している。 | |
* The IO module contains I/O stuff. IO.write() writes to stdout. IO.stdout.write() would do the same. In Zimbu things that you use often are kept short. The long form is available for consistency. | |
* IOモジュールは言語の一部であり、インポートする必要はない。Zimbu はモジュールがどこにあるか知っている。 | |
* The IO module is part of the language, no need to import it, we know where it is. | |
* "\n"は改行の文字だ。エスケープ文字はCやJavaと同様のものが使える。改行を付け加えるものとしてIO.writeLine()もある。 | |
* "\n" is a newline character. String escape characters are used like in C and Java. There also is IO.writeLine() which appends the newline character. | |
* 式の後のセミコロンはなし | |
* There is no semicolon to end a statement. | |
* }はブロックの終わりに使われる。{は不要、ブロックの始まりは自明だから。これは{をどこに置くかという意味のない議論を避けることができる。 | |
* The } character is used to end a block. There is no {, we know where the block starts. This avoids useless discussions about where to put the {. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment