aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-10-19 05:52:19 +0200
committerBjörn Gustavsson <[email protected]>2018-10-19 13:02:36 +0200
commit131ff5fac7da80fe8080425182bf29f673ab301c (patch)
treefd41df896e19e02833b5b850961955f7865b8f87 /lib
parent31562b636b1c89595c2bb4bb81bc7f781e6bd269 (diff)
downloadotp-131ff5fac7da80fe8080425182bf29f673ab301c.tar.gz
otp-131ff5fac7da80fe8080425182bf29f673ab301c.tar.bz2
otp-131ff5fac7da80fe8080425182bf29f673ab301c.zip
beam_lib: Remove obsolete module() from the beam() type
The type `beam()` in the `beam_lib` module is confusing: -type beam() :: module() | file:filename() | binary(). It says that the module name can be used to identify the BEAM module to be accessed, but passing in the module name only works if the BEAM file is located in the current working directory because the module is not searched for in the code path. The reason that it is allowed to pass in the module name as an atom is for backward compatibility. A long time ago, atoms instead of strings were used as filenames. For that reason, `filename` and `file` still accept atoms as filenames (although the practice is frown upon). `beam_lib` accepts an atom as the filename for the same reason. To remove the confusion, remove `module()` from the type and the mention of it in the documentation. Code that uses an atom as a filename will still work, but Dialyzer will issue a warning. https://bugs.erlang.org/browse/ERL-696
Diffstat (limited to 'lib')
-rw-r--r--lib/stdlib/doc/src/beam_lib.xml4
-rw-r--r--lib/stdlib/src/beam_lib.erl2
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/stdlib/doc/src/beam_lib.xml b/lib/stdlib/doc/src/beam_lib.xml
index 26d0724aaf..213170df7f 100644
--- a/lib/stdlib/doc/src/beam_lib.xml
+++ b/lib/stdlib/doc/src/beam_lib.xml
@@ -180,8 +180,8 @@ io:fwrite("~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]).</code>
<name name="beam"/>
<desc>
<p>Each of the functions described below accept either the
- module name, the filename, or a binary containing the BEAM
- module.</p>
+ filename (as a string) or a binary containing the BEAM
+ module.</p>
</desc>
</datatype>
<datatype>
diff --git a/lib/stdlib/src/beam_lib.erl b/lib/stdlib/src/beam_lib.erl
index 01181b1097..3386cfcbe6 100644
--- a/lib/stdlib/src/beam_lib.erl
+++ b/lib/stdlib/src/beam_lib.erl
@@ -53,7 +53,7 @@
%%-------------------------------------------------------------------------
--type beam() :: module() | file:filename() | binary().
+-type beam() :: file:filename() | binary().
-type debug_info() :: {DbgiVersion :: atom(), Backend :: module(), Data :: term()} | 'no_debug_info'.
-type forms() :: [erl_parse:abstract_form() | erl_parse:form_info()].