Skip to content

Instantly share code, notes, and snippets.

@jorendorff
Created April 6, 2017 23:34
Show Gist options
  • Save jorendorff/eda72953cc9f0787320b4bb36c6605aa to your computer and use it in GitHub Desktop.
Save jorendorff/eda72953cc9f0787320b4bb36c6605aa to your computer and use it in GitHub Desktop.
# I claim attributes are a run-time feature
defmodule Petunia do
Module.register_attribute(__MODULE__, :myattr, accumulate: false)
Module.put_attribute(__MODULE__, :myattr, 1)
IO.puts(@myattr)
Module.put_attribute(__MODULE__, :myattr, 2)
IO.puts(@myattr)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment