ISWIM : SECD machine : P.J. Landin

クロージャの一件で、Landinさんという名前を知ったのだけれど、この方について調べてみたら、面白いことに行き当たりました。
(下の論文には、クロージャ(閉包)という言葉をLandinが使ったという記述があります。
 http://www.ice.nuie.nagoya-u.ac.jp/~h003149b/lang/p/funarg/funarg.html


P.J. Landinさんは1960年代にISWIMというプログラミング言語とそのバーチャルマシンとしてSECDマシンというものを作った方らしいです。
http://en.wikipedia.org/wiki/Peter_J._Landin
http://en.wikipedia.org/wiki/ISWIM_programming_language
http://en.wikipedia.org/wiki/SECD_machine


このISWIMという言語は

  • 純粋関数型 : purely functional
  • 遅延評価 : lazy evaluation
  • インデントによるブロック : off-side rule
  • where clause

という特徴をもっています。
HaskellConcurrent Cleanの直系のご先祖様です。


SECDマシンは、ISWIMのバーチャルマシンです。スタックベースで、S,E,C,Dというレジスタを持っています。
Concurrent Cleanは、ABCマシンというバーチャルマシンを持ちますけど、一見したところは、かなり似ているので、こちらもおそらくご先祖様から受け継いでいるのでしょう。
http://skelet.ludost.net/sec/ ← SECDの実装がダウンロードできるようです。また、略歴も書かれています。


で、このSECDマシンの説明の中にclosureという言葉が出てくるのですね。
Lispクロージャが採用されたのは、Schemeが最初という話だそうですが、Schemeは1975年にできたそうです。
SECDマシンは、1963年に記述があるそうなので、こちらの方が古いことになりそうなのですが、該当する論文をまだ読めていないんですよね。


で、以下の論文を読んでみたいと思って探しているのですが・・・
"The Mechanical evaluation of Expressions" P.J. Landin The Computer Journal Vol. 6 pp308-320 1964
追記)id:suminさんに教えてもらいました。
http://web.archive.org/web/20030106035107/http://www3.oup.co.uk/computer_journal/hdb/Volume_06/Issue_04/060308.sgm.abs.html


p.316

Also we represent the value of a λ-expression by a bundle of information called a "closure," comprising the λ-expression and the environment relative to which it was evaluated. We must therefore arrange that such a bundle is correctly interpreted whenever it has to be applied to some argument. More precisely:
a closure has

an environment part which is a list whose two items are:

  1. an environment
  2. an identifier or list of identifiers

and a control part which consists of a list whose sole item is an AE.

The value relative to E of a λ-expression X is represented by the closure denoted by

constructclosure( (E, bvX), unitlist(bodyX) ).

This particular arrangement of the information in a closure has been chosen for our later convenience.

p.320

Closures are roughly the same as McCarthy's "FUNARG" lists and Dijkstra's PARD's.


ありました、closureの定義が。おそらく、これが、closureという言葉がコンピューターサイエンスの世界に登場した最初の瞬間なのでしょう。
それにしても、closureという言葉が、副作用がない*1純粋関数型言語の文脈で生まれたということは、意外な発見です。


ところで、現在、一般的にクロージャと呼ばれているものは、レキシカルクロージャのことを指しているのですが、このときのクロージャはおそらくダイナミッククロージャだったのではないかと思います。*2

*1:論文を十分読み込んでいないので、該当の記述を見つけたわけではありませんが。

*2:このことも、論文を読み込んで確認する必要がありますが。