Module level variables - undocumented usage?


I came across above lines of code in the elixir code base. It would seem these variables were defined at module level and used from functions within the module.

I thought we could only do this with @constants:

The temporary-storage documentation does not make it clear either that such module level variables are permited.

Could this usage be documented better?


I believe those are run at compile time and can only be used in macros.


if you refer to the source code, they were used in functions



In the code that you linked, you have this:

  def to_record(%File.Stat{unquote_splicing(pairs)}) do
    {:file_info, unquote_splicing(vals)}

unquote_splicing is run at compile time.