現在開始流行開發程式語言? 大家都要寫一套~ XD
- Vim 作者 Bram Moolenaar 開發新程式語言 - Zimbu.
- Google 開發新的程式語言 - Go.
新聞
Zimbu 特色
- Zimbu 官方網站: Home (the Zimbu programming language)
- Zimbu 下載: zimbu - A no-nonsense programming language (Google Code)
- 下述取自 官方首頁: (Zimbu 要打倒的對象. XD)
- It has to be as fast as possible, so interpreted languages are out.
- You don't want to micro manage memory, so C is out.
- You don't want to require programmers to have a degree, so C++ is out.
- You want fast startup and not depend on a big runtime, so Java is out.
- It has to run on most systems, anything with a C compiler, so D is out.
- You want to have fun making something new.
Zimbu 範例
hello.zu
MAIN()
IO.write("Hello, World!\n")
}
看完此 Hello world 的範例, 如果要學的話, Vim 的縮排又要開始頭痛了~
Go 特色
- 官方網頁: The Go Programming Language
- 下述取自 官方網頁:
- a systems programming language
- expressive, concurrent, garbage-collected
- simple, fast, safe, concurrent, fun, open source
hello.go
package main
import "fmt"
func main() {
fmt.Printf("Hello, 世界\n")
}
註: 上述是官方首頁的完整範例, "世界" 確實是打中文沒錯~ 🙂 是漢字. XD
Go 語法 範例
package main
import fmt "fmt"
const (
Space = " ";
)
func main() {
var s string = "";
for i := 0; i < 10; i++ {
if i > 0 {
s += Space
}
s += "foo"
}
var a int;
b := 0;
c := 0;
switch {
case a < b:
c = -1
case a == b:
c = 0
case a > b:
c = 1
}
}