Skip to content

Commit db47cca

Browse files
rawtazJosé Valim
authored and
José Valim
committed
doc: Clarify available functions in attribute definitions (elixir-lang#1346)
Clarifies that functions in the same module as the attribute is defined in cannot be called as they are not compiled yet.
1 parent 216739c commit db47cca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

getting-started/module-attributes.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ MyServer.second_data #=> 13
115115

116116
Every time an attribute is read inside a function, a snapshot of its current value is taken. In other words, the value is read at compilation time and not at runtime. As we are going to see, this also makes attributes useful to be used as storage during module compilation.
117117

118-
Any functions may be called when defining a module attribute.
118+
Any functions may be called when defining a module attribute. However, please note that functions you define in the same module as the attribute itself cannot be called, as they are not yet compiled at the time that the attribute is defined.
119119

120120
When defining an attribute, do not leave a line break between the attribute name and its value.
121121

0 commit comments

Comments
 (0)