This is not for the feint of heart. Pls don't ask how or why.
So.... I have some code like this ```elixir
def compile_function(env, name, opts) do
fun_args =
for arg <- [:hello, :how, :are, :you] do
Macro.var(arg, env.module)
end
handler =
quote do
apply(unquote(env.module), unquote(:nice_function), unquote(fun_args))
end
quote do
unquote(quoted_docs(opts))
def unquote(:"#{name}")(unquote_splicing(fun_args)) do
unquote(handler)
end
end
endThis successfully creates a function that looks like thiselixir
@doc "Works well, Gives hope for future (aka Peak of Mt. Stupid)"
def generated_function(hello, how, are, you) do
apply(Test, :nice_function, [hello, how, are, you])
end All good so far. However ... I need(!) to get that variable into something more easily digested. for example something likeelixir
@doc "My dream of the future"
def generated_function(hello, how, are, you) do
apply(Test, :nice_function, [%{hello: hello, how: how, are: are, you: you}])
end My problem is that whenever i try to use a `Macro.var/2` anywhere except the top level of `unquote_splicing` I end up with the ast coming through like thiselixir
@doc "Valley of dispair I currently reside in"
def generated_function(id) do
apply(Test, :nice_function, [[%{id: {:id, [], Test}}]])
end``` Please send help.
PS: Will also require food and blankets if I cant get this figured out soon
