pinterest / elixometer

A light Elixir wrapper around exometer.

Home Page:https://hexdocs.pm/elixometer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Making private functions overridable is deprecated

jparise opened this issue · comments

We use Module.make_overridable/2 as part module compilation step. This is deprecated for private functions, as show here from our unit test run:

warning: making private functions (secret_timed/0 in this case) overridable is deprecated
  (elixir) lib/module.ex:815: anonymous fn/2 in Module.make_overridable/2
  (stdlib) lists.erl:1338: :lists.foreach/2
  (elixometer) lib/elixometer.ex:135: Elixometer."-MACRO-__before_compile__/2-fun-0-"/2
  (elixir) lib/enum.ex:1229: Enum."-map/2-lists^map/1-0-"/2
  (elixir) lib/enum.ex:1229: Enum."-map/2-lists^map/1-0-"/2

We can easily avoid this warning in our tests by making secret_timed/0 non-private, but we should revisit this approach in general and do one of the following:

  1. Document the fact that we can't decorate private functions.
  2. Change the implementation to something that also support private functions.

I no longer see this warning when compiling under Elixir 1.4.5 / OTP 20.0. Was this restriction relaxed in a recent Elixir version?

It looks like this warning was removed in elixir@f020a46.