I am just doing some poking around with module attribute and I created the following code:
defmodule ModuleAttribute do
Module.register_attribute(__MODULE__, :test_attribute, accumulate: true)
@test_attribute 1
@test_attribute 10
def increase(), do: IO.inspect(@test_attribute, label: "Value")
@test_attribute 20
end
When I run iex -S mix i get the following values
iex(40)> ModuleAttribute.increase
Value: [10, 1]
If my understanding of elixir compilation is correct, should it be [1, 10, 20]? I am not sure why 20 didn’t get added in during compilation.


















