From 877fca875a92c01089ca0697e1aeecb1ff37708e Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 31 Mar 2024 22:14:31 -0500 Subject: Error on unbound variables I still need to catch errors! --- eval.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eval.lua b/eval.lua index 714c67e..2e3a2bf 100644 --- a/eval.lua +++ b/eval.lua @@ -103,6 +103,9 @@ m.specials.def = m.specials.define function m.eval (x, env) local env = env or core.env if type.isa(x, "symbol") then + if env[x] == nil then + error(string.format("Unbound variable: %s", x)) + end return env[x] elseif not type.islist(x) then return x -- cgit 1.4.1-21-gabe81