Skip to content

Commit 682a7ed

Browse files
committed
Add docs around @on_load
1 parent b51fd94 commit 682a7ed

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/elixir/lib/module.ex

+6
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,12 @@ defmodule Module do
421421
end
422422
end
423423
424+
The function given to `on_load` should avoid calling functions from
425+
other modules. If you must call functions in other modules and those
426+
modules are defined within the same project, the called modules must
427+
have the `@compile {:autoload, true}` annotation, so they are loaded
428+
upfront (and not from within the `@on_load` callback).
429+
424430
### `@vsn`
425431
426432
Specify the module version. Accepts any valid Elixir value, for example:

0 commit comments

Comments
 (0)