Archive for 十二月, 2009

一個關於Ken Thompson的小故事

星期五, 十二月 11th, 2009

Go 的建立者之一,也是UNIX的建立者 Kenneth Thompson Kenneth Thompson
他在1960年發明了 B 語言,然後和 C 語言的建立者之一 Dennis Ritchie 一起用 C 語言寫了 UNIX 作業系統。
Anyway,他一直有一個遺憾。

http://en.wikiquote.org/wiki/Kenneth_Thompson

Ken Thompson was once asked what he would do differently if he were redesigning the UNIX system. His reply: 『I’d spell creat with an e.』
Ken Thompson有一次被問到,如果你有機會重新設計UNIX系統,你最想改的是甚麼?他回答:我會讓creat這個拼寫加上e。

就是 UNIX 的系統呼叫建立檔案都是用 O_CREAT。
他一直想要把它改成 O_CREATE ,但是 O_CREAT 已經被 IEEE 已經加到 POSIX 裡作為規範了。

因為Go,他終於辦到了…

Ken Thompson的Log message


// Flags to Open wrapping those of the underlying system. Not all flags
// may be implemented on a given system.
const (
O_RDONLY = syscall.O_RDONLY; // open the file read-only.
O_WRONLY = syscall.O_WRONLY; // open the file write-only.
O_RDWR = syscall.O_RDWR; // open the file read-write.
O_APPEND = syscall.O_APPEND; // open the file append-only.
O_ASYNC = syscall.O_ASYNC; // generate a signal when I/O is available.
O_CREAT = syscall.O_CREAT; // create a new file if none exists.
O_EXCL = syscall.O_EXCL; // used with O_CREAT, file must not exist
O_NOCTTY = syscall.O_NOCTTY; // do not make file the controlling tty.
O_NONBLOCK = syscall.O_NONBLOCK; // open in non-blocking mode.
O_NDELAY = O_NONBLOCK; // synonym for O_NONBLOCK
O_SYNC = syscall.O_SYNC; // open for synchronous I/O.
O_TRUNC = syscall.O_TRUNC; // if possible, truncate file when opened.
O_CREATE = O_CREAT; // create a new file if none exists.
)

………………..花了40年啊~

聽完這個故事有沒有很感動? 要不要好好學 go?
http://golangd.com/