5b1f6f9

Faddle · faddle.git · Tickets

Branches > main > 5b1f6f9 > files

Use locals instead of globals in let

Grahp, 2026-07-19

Commit: 5b1f6f9ff5ac460edd2b83903aaf2e4c6c092791
Parent: 9a99ede

1 changed file:

org/faddle/lang/compile.lua modified (view file)

@@ -78,10 +78,10 @@   while i < #bindings do     local sym = bindings[i]     local binding = bindings[i + 1]-    locals[#locals + 1] = munge(sym) .. "=" .. compile(binding) .. ";"+    locals[#locals + 1] = "local " .. munge(sym) .. "=" .. compile(binding) .. ";"     i = i + 2   end-  return "do " .. table.concat(locals) .. " end"+  return table.concat(locals) end  -- If I'm just using the same lexical stuff as Lua, how do builtin Lua modules work?@@ -97,7 +97,7 @@   local bindings = first(args)   local body = rest(args)   if statement then-    return build_let_bindings(bindings) .. ";" .. compile_body(body)+    return "do " .. build_let_bindings(bindings) .. compile_body(body) .. " end"   else     -- Not sure if this is the best way to go about this :p     return "return (function()" .. compile_let(form, not statement) .. " end)()"