defineサポート

defineが使えるようになったぜい。

$ cat example/define.scm
(define x 42)

(define (inc x)
  (+ x 1))

(print (inc x))

$ ocamlbuild main.byte -- example/define.scm
Finished, 47 targets (47 cached) in 00:00:01.

$ avmplus a.abc
43

でも、internal defineは使えません。

$ cat example/define.scm
(define (inc x)
  (define y 10)
  (+ x 1))

$ ocamlbuild main.byte -- example/define.scm
Finished, 47 targets (47 cached) in 00:00:01.
camlp4-debug: exc: Not_found at File "src/ast.ml", line 203, characters 14-65
camlp4-debug: exc: Not_found at File "src/ast.ml", line 206, characters 15-36
camlp4-debug: exc: Not_found at File "src/ast.ml", line 209, characters 2-266 (end at line 217, character 46)
camlp4-debug: exc: Not_found at File "src/main.ml", line 20, characters 2-463 (end at line 35, character 7)
Fatal error: exception Not_found

defineは、環境を壊すから実装が面倒でした。