CLHS 3.1.1 Introduction to Environments

Binding について実装の観点から調べている。暫く調べていたが、let の入れ子になった環境で、中の環境から外の環境が参照できる、という当たり前のことが仕様書のどこに書かれているのか分からなくなった。

http://www.lisp.org/HyperSpec/Body/sec_3-1-1.html より。

  • a binding とは、名前とそれが示すものの関連
  • environments とは、 bindings の set

Environments は種類があって、それぞれ格納できる binding が明確に異なっている。

Global Environments

  • bindings of dynamic variables and constant variables.
  • bindings of functions, macros, and special operators.
  • bindings of compiler macros.
  • bindings of type and class names
  • information about proclamations.

Dynamic Environments

  • bindings for dynamic variables.
  • information about active catch tags.
  • information about exit points established by unwind-protect.
  • information about active handlers and restarts.

Lexical Environments

  • bindings of lexical variables and symbol macros.
  • bindings of functions and macros. (Implicit in this is information about those compiler macros that are locally disabled.)
  • bindings of block tags.
  • bindings of go tags.
  • information about declarations.

うーん、どこにも親の環境を順番にたどる、というような記述が見つけられない。仕様書を読むのも訓練だ、もう少し追いかけよう。