Outer context

只今読み中の論文

Prototyping realistic programming languages based on formal specifications: Arnd Poetzsch-Heffter, Springer-Verlag 1997

まだ流し読み中だけれども,気になる記述があった.

P747

FCT encl_method( Exp@ E ) Method@:
  IF Method@<_,_,E> M THEN M
   | Send@<_,_,<*,E,*>> S THEN S.encl_method
   | Program@<_,E> THEN nil
  ELSE E.parent.encl_method

The function encl method demonstrates several aspects: The use of occurrences enables to define functions yielding nodes in the outer context of the argument node.

要するに,メソッドの定義中に「このメソッドはこのクラスに属しているぞー」とセマンティクスに書きたい場合があるが,このとき外側のクラスのセマンティクスを好きなように参照できる,という仕組みだと思う.必ずほしい仕組み.