Yet another Language : Fantom

4123阅读 0评论2010-08-26 mhsy2003
分类:



-----------------------------------------
D:\GNU\fantom-1.0.54\bin>fansh
Fantom Shell v1.0.54 ('?' for help)
fansh> echo("hello world #1")
hello world #1
fansh> quit

D:\GNU\fantom-1.0.54\bin>vim hello.fan

D:\GNU\fantom-1.0.54\bin>fan hello.fan
hello world #2

D:\GNU\fantom-1.0.54\bin>type hello.fan
class Hello{
static Void main(){
echo("hello world #2")
}
}

D:\GNU\fantom-1.0.54\bin>vim fwt-test.fan

D:\GNU\fantom-1.0.54\bin>fan fwt-test.fan

D:\GNU\fantom-1.0.54\bin>type fwt-test.fan
using fwt
class MyWindow:Test{
Void main(){
Window{
Label{text="Hello world"},
}.open
}
}

D:\GNU\fantom-1.0.54\bin>fan fwt-test.fan

D:\GNU\fantom-1.0.54\bin>vim webapp-test.fan


D:\GNU\fantom-1.0.54\bin>vim webapp-test.fan

D:\GNU\fantom-1.0.54\bin>type webapp-test.fan
using util
using web
using wisp
class WebHelloWorld:AbstractMain{
@Opt {help = "http port"}
Int port := 8080
override Int run(){
wisp := WispService{
it.port = this.port
it.root = HelloMod()
}
return runServices([wisp])
}
}
const class HelloMod:WebMod{
override Void onGet(){
res.headers["Content-Type"]="text/plain';charset=utf-8"
res.out.print("hello world #4")
}
}

D:\GNU\fantom-1.0.54\bin>fan webapp-test.fan
[16:14:01 25-Aug-10] [info] [web] WispService started on port 8080
上一篇:tessellations的艺术
下一篇:Yet Anothor 通宵