Open EugZol opened 8 years ago
I don't remember the details, but this has to do with macros.
Basically deftable
is a macro, and the passed name
is unquoted, so it tries to call a name/0
function that does not exist.
Ask a general question in the main channel and report back please, a long time ago there were unquote fragments, I don't know what the story is currently.
Actually I ran over the same issue when defining my own defconst macro (similar to Record.defrecord) and using bind_quoted in your quote block like this
quote bind_quoted: [x: x] do
helped resolve the issue for me. Because when doing something like Record.defrecord I also did a loop like the above. Without the bind_quoted I found no way to make it work.
http://elixir-lang.org/docs/stable/elixir/Kernel.SpecialForms.html#quote/2
Hello!
I'm trying to create bunch of tables at once with the following code:
That gives me the following error:
I noticed that this code, however, is compiled correctly:
Given that, I decided to ask that question in the Amnesia tracker, not in some general Elixir thread.
How do I do table definitions with dynamic names correctly?