Skip to content

Instantly share code, notes, and snippets.

@bowbow99
Created November 27, 2010 02:21
Show Gist options
  • Select an option

  • Save bowbow99/717490 to your computer and use it in GitHub Desktop.

Select an option

Save bowbow99/717490 to your computer and use it in GitHub Desktop.
let* とスペシャル変数のあれ http://d.hatena.ne.jp/bowbow99/20101127/1290818576 #xyzzy
diff --git a/src/eval.cc b/src/eval.cc
old mode 100644
new mode 100755
index 6dec67b..9fdacb8
--- a/src/eval.cc
+++ b/src/eval.cc
@@ -289,7 +289,7 @@ special_bind::~special_bind ()
}
}
-static lisp
+lisp
declare_progn (lisp body, lex_env &lex, int can_doc)
{
int nvars = 0;
diff --git a/src/fns.h b/src/fns.h
old mode 100644
new mode 100755
index afd76bb..8888401
--- a/src/fns.h
+++ b/src/fns.h
@@ -4,6 +4,7 @@
/* eval.cc */
lisp eval (lisp, lex_env &);
+lisp declare_progn (lisp, lex_env &, int);
lisp funcall_1 (lisp, lisp);
lisp funcall_2 (lisp, lisp, lisp);
lisp funcall_3 (lisp, lisp, lisp, lisp);
diff --git a/src/lex.cc b/src/lex.cc
old mode 100644
new mode 100755
index 20923e8..43c9076
--- a/src/lex.cc
+++ b/src/lex.cc
@@ -31,7 +31,11 @@ lex_env::let (lisp varlist, lex_env &eval_lex)
{
lisp tem = xcdr (var);
if (consp (tem))
- bind (xcar (var), eval (xcar (tem), eval_lex));
+ {
+ if (xcdr (tem) != Qnil)
+ FEinvalid_variable_list (varlist);
+ bind (xcar (var), declare_progn (tem, eval_lex, 0));
+ }
else
bind (xcar (var), Qnil);
}
@bowbow99
Copy link
Author

  • init-form が単一の式じゃないとエラー吐くようにした
  • init-form の評価が遅くなったはず
    • let* だけじゃなくて let も
    • インタプリタで評価した時だけだから許して(言い訳
  • static 外しちゃうってどうなのよ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment