インタプリタ
Nemerleにはnemishというインタプリタがあるのですが、ネタにするのをすっかり忘れてました。(^^; で、nemishを使う前に注意。nemish.exeのあるディレクトリにNemerle.Macros.dllをコピーする必要があります。GACに登録されているのに、何故か要求されるんですよね。
インタプリタを起動してみる。
$ mono nemish.exe
起動画面はこんな感じ。入力の最後に;;を付けるとインタプリタが評価します。
Welcome to Nemerle interpreter (using ncc 0.9.0.685). Please enter expressions appended with ";;". Type "Help;;" for more info. Please wait while evaluating the config file..
先頭が-(ハイフン)なのが入力行。その他はnemishからの応答です。Refにアセンブリ名を代入すると参照が追加されます。
- Ref="System.Windows.Forms";; def it : void
ボタンが1つだけあるウィンドウを表示させるコードをざっくり。
- using System.Windows.Forms;; - def form = Form ();; Mono System.Windows.Forms Assembly [Revision: 49925; built: 2005/9/11 14:27:24] def form = System.Windows.Forms.Form, Text: : System.Windows.Forms.Form def it : void - def button = Button ();; def button = System.Windows.Forms.Button, Text: : System.Windows.Forms.Button def it : void - button.Text = "OK";; def it : void - button.Click += fun (_,_) { form.Close (); };; def it : void - form.Controls.Add (button);; def it : void - Application.Run (form);;
すると、ウィンドウが表示されます。
・・・が、ボタンを押しても終了しないんですよね。nemishの問題かなぁ。