@@ -297,6 +297,8 @@ defmodule Module do
297
297
When just a module is provided, the function is assumed to be
298
298
`__after_compile__/2`.
299
299
300
+ Callbacks registered first will run last.
301
+
300
302
#### Example
301
303
302
304
defmodule MyModule do
@@ -312,13 +314,18 @@ defmodule Module do
312
314
A hook that will be invoked before the module is compiled.
313
315
314
316
Accepts a module or a `{module, function_or_macro_name}` tuple. The
315
- function/macro must take one argument: the module environment. If it's a
316
- macro, its returned value will be injected at the end of the module definition
317
- before the compilation starts.
317
+ function/macro must take one argument: the module environment. If
318
+ it's a macro, its returned value will be injected at the end of the
319
+ module definition before the compilation starts.
318
320
319
321
When just a module is provided, the function/macro is assumed to be
320
322
`__before_compile__/1`.
321
323
324
+ Callbacks registered first will run last. Any overridable definition
325
+ will be made concrete before the first callback runs. A definition may
326
+ be made overridable again in another before compile callback and it
327
+ will be made concrete one last time after after all callbacks run.
328
+
322
329
*Note*: unlike `@after_compile`, the callback function/macro must
323
330
be placed in a separate module (because when the callback is invoked,
324
331
the current module does not yet exist).
0 commit comments