Skip to content

Commit a6317d5

Browse files
author
José Valim
committed
Merge pull request #1090 from alco/require_file-docfix
Fix docstring for require_file
2 parents a57be73 + e96963c commit a6317d5

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/elixir/lib/code.ex

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -205,17 +205,17 @@ defmodule Code do
205205
end
206206

207207
@doc """
208-
Requires the given `file`. Accepts `relative_to` as an argument
209-
to tell where the file is located. If the file was already
210-
required/loaded, loads it again. It returns all the modules
211-
defined in the file.
208+
Requires the given `file`. Accepts `relative_to` as an argument to tell where
209+
the file is located. It returns all the modules defined in the file. If the
210+
file was already required/loaded, doesn't do anything and returns nil.
211+
212+
Notice that if `require_file` is invoked by different processes concurrently,
213+
the first process to invoke `require_file` acquires a lock and the remaining
214+
ones will block until the file is available. I.e. if `require_file` is called
215+
N times with a given file, it will be loaded only once. The first process to
216+
call `require_file` will get the list of loaded modules, others will get nil.
212217
213-
Notice that if `require_file` is invoked by different processes
214-
concurrently, the first process to invoke `require_file` acquires
215-
a lock and the remaining ones will block until the file is
216-
available. I.e. if `require_file` is called N times with a given
217-
file, the given file will be loaded only once. Check `load_file`
218-
if you want a file to be loaded concurrently.
218+
Check `load_file` if you want a file to be loaded concurrently.
219219
"""
220220
def require_file(file, relative_to // nil) when is_binary(file) do
221221
file = find_file(file, relative_to)

0 commit comments

Comments
 (0)