再帰クラスを使うと、型が相互に再帰的なオブジェクトを定義することができます
#
class window = object val mutable top_widget = (None : widget option) method top_widget = top_widget end and widget (w : window) = object val window = w method window = window end;;
class window : object val mutable top_widget : widget option method top_widget : widget option end and widget : window -> object val window : window method window : window end
型は相互に再帰的ですが、widget
クラスと window
クラス自体は独立です。