
程序语言 A - Z
Computerworld 有一个系列叫做“程序语言 A - Z”,对一些有广泛影响的程序语言的设计者进行访谈。目前已经做了十几集,而且还在进行当中,我们将关注并持续更新这里的链接。
- 2 comments
- Read more
- 156 reads

Git's functional nature (with an encoding in OCaml)
昨天研究了一下 git 的设计,一个发现是 git 的强大很大程度上源自于它的函数性设计。
Git 并不是一个程序,而是一系列工具围绕在一个核心表示的周围,而这个核心是 functional 的。在Git 的核心表示中,实体(objects),比如 blob, tree 和 commit, tag,全是 persistent,也就是说一旦记录,永不改变。
其中,最根本的概念是 commit。一次 commit,记录了当下文件目录结构的全部状态。其主要信息,由 blob(文件内容) 和 tree(目录结构) 的某种编码构成,为了简单我们可以把它想象成 FP 里常见的"树":
type tree =
| Blob of blob
| Tree of string * tree list
| Blob of blob
| Tree of string * tree list
既然这些全都是 persistent 的,那么 commits 如何 evolving 呢?
- 5 comments
- Read more
- 211 reads









