formular
formular copied to clipboard
Deprecation warning
This line is responsible for a deprecation warning when using Tablex
warning: :functions option in eval is deprecated
(elixir 1.15.7) src/elixir.erl:294: :elixir.env_for_eval/1
(elixir 1.15.7) lib/code.ex:998: Code.eval_quoted/3
(formular 0.4.1) lib/formular.ex:354: Formular.do_eval/3
(tablex 0.3.1) lib/tablex/decider.ex:193: anonymous fn/3 in Tablex.Decider.maybe_exec_code/3
(elixir 1.15.7) lib/map.ex:257: Map.do_map/2
(elixir 1.15.7) lib/map.ex:251: Map.new_from_map/2
This can easily be fixed by changing the code to look like the following:
defp do_eval(ast, binding, context) do
{ret, _binding} =
ast
|> Code.eval_quoted(
binding,
%Macro.Env{
functions: imported_functions(context),
macros: imported_macros(context),
requires: [Elixir.Kernel]
}
)
{:ok, ret}
rescue
err ->
{:error, err}
end
I.e. make use of the Macro.Env structure instead.