letrecとdisplay closureの関係になやむ
letrecとdisplay closureの関係になやむ。
Gauche のcompile.scmにおける letrec の扱いを読んでみるか。
;; LOCAL-ENV-CLOSURES(nlocals) <codelist> ;; Used for letrec. ;; Similar to LOCAL-ENV, but this doesn't use the current arg frame. ;; The operand contains a literal list of compiled codes. This instruction ;; creates a frame of NLOCALS size, then creates closures ;; with the new environment and the given compiled codes, and fills the ;; new frame with the created closures. CODELIST can have 'holes', i.e. ;; if it has #f instead of a compiled code, the corresponding frame entry ;; is left undefined. ;; This instruction also leaves the last closure in VAL0.
このあたりか。
追記
ノートにいろいろ描き殴っていたらできた!