lib/lasp/interpreter.rb in lasp-0.11.0 vs lib/lasp/interpreter.rb in lasp-0.12.0
- old
+ new
@@ -33,10 +33,14 @@
else call_function(head, tail, env)
end
end
def resolve_symbol(symbol, env)
- env.fetch(symbol)
+ if symbol.to_s.match(/^[A-Z]/)
+ Object.const_get(symbol.to_s.gsub("/", "::"))
+ else
+ env.fetch(symbol)
+ end
rescue KeyError
raise NameError, "#{symbol} is not present in this context"
end
def call_function(symbol, args, env)