View Source Docp (docp v1.0.1)
Docp lets you add documentation to private functions via the @docp
module attribute.
You shouldn't, but you can.
defmodule MyModule do
use Docp
@typedocp """
Valid range for priorities is `1..99`.
"""
@typep priority :: pos_integer
@docp """
Does something
"""
defp foo, do: :something
end
Docp will ensure that the Elixir compiler doesn't raise a warning about @docp
or @typedocp
being unused.
When to use this library
As a general rule of thumb, documenting private functions is discouraged and should be avoided. Consider first moving the private functions into a separate module and then converting them to public functions.
Ultimately, only you know what's best for your project, and if you think it's useful to add a docstring to a private function, go for it. Dogma should not dictate software development.