This document describes the changes made to the STDLIB application.
lists:sort/1
and
lists:keysort/2
and a mix of floating point
numbers and integers has been fixed.erlang:garbage_collect/0
in the
Erlang shell not only the evaluator process (the one
returned by calling self()
in the Erlang shell) is
garbage collected, but also the process holding the
history list.beam_lib
module that used to
catch exceptions and return a tuple
{'EXIT',Reason}
now exit with the reason
Reason
.erl_eval
module now calls the non-local
function handler whenever an operator is evaluated
(exceptions are andalso
, orelse
, and
catch
). The non-local function handler is now also
called when the function or operator occurs in a guard
test (such calls used to be ignored).non_local_allowed/3
is now called for operators
such as '!'/2
. This means that
non_local_allowed/3
may need to be changed as to
let operators through. Note that erlang:'!'/2
as
well as erlang:send/2,3
have to be restricted in
order to stop message passing in the shell.
warn_obsolete_guard
can
be used for turning on warnings for calls to old type
testing BIFs.escript
, there is a new
function escript:script_name/0
, which can be used
to retrieve the pathame of the script. The documentation
has been clarified regarding pre-defined macros such as
?MODULE and the module name.
code:module_md5/1
, beam_lib:md5/1
, and by
the compiler for the default value of the vsn
attribute have all been changed so that its result will
be the same on all platforms; modules containing funs
could get different MD5s on different platforms.file_sorter
module
(the option Format
set to term
), file
errors were not always properly handled. This bug has
been fixed.tmpdir
option is no longer checked unless it is
actually used. The error reason not_a_directory
can no longer be returned; instead a file_error
tuple is returnedtry
/catch
have been fixed
in the erl_eval
module.file:open/3
with bad arguments. This bug
has been fixed.
beam_lib:cmp/1
and
beam_lib:strip/1
(and similar functions) have been
updated to handle optional chunks (such as "FunT") in
more general way in order to be future compatible.beam_lib:chunks/3
has been
added.beam_lib:md5/1
has been added.non_local_allowed/3
used
by the restricted shell can now return the value
{{restricted,NewFuncSpec,NewArgList},NewState}
which can be used for letting the shell call some other
function than the one specified.escript
program that can be used
for writing scripts in Erlang. Erlang scripts don't need
to be compiled and any arguments can be passed to them
without risk that they are interpreted by the Erlang
system.Format
argument of the functions
io:fwrite/2,3
and io_lib:fwrite/2
is now
allowed to be a binary.
p
and P
of the
Format
argument of the functions
io:fwrite/2,3
and io_lib:fwrite/2
could
cause a badarg
failure when applied to binaries.
This bug was introduced in STDLIB 1.14.3. (Thanks to
Denis Bilenko.)
spawn_opt/2,3,4,5
option monitor
--
introduced in Kernel 2.11.2 -- is currently not possible
to use when starting a process using proc_lib
,
that is, also when starting a gen_server, gen_fsm etc. gen_fsm
, gen_server
, and
proc_lib
start
and start_link
functions when providing this option has been changed
from hanging indefinitely to failing with reason
badarg
.
P
of the Format
argument of the functions io:fwrite/2,3
and
io_lib:fwrite/2
now replaces the tail of binary
strings with ...
when the maximum depth has been
reached. For instance, io:fwrite("~P", [<<"a binary
string">>, 3]).
prints <<"a binary"...>>
.,...
is printed
instead of |...
(this change applies to the
control sequence W
as well).h/0
that prints the
history list now avoids printing (huge) terms referred to
by v/1
but instead just prints the call to
v/1
.
dets:select/1,3
,
dets:match/1,3
, and dets:match_object/1,3
have been changed as to never return
{[],Continuation}
. This change affects the
corresponding functions in Mnesia.qlc:info()
could crash if the
tmpdir
option did not designate a valid directory;
the results of looking up keys are kept in RAM, which
should improve performance.
erl_pp:exprs()
has been fixed.
p
and P
of the
Format
argument of the functions
io:format/2,3
and io_lib:format/2
did not
handle binaries very well. This bug, introduced in
stdlib-1.14, has been fixed.
filelib:wildcard(Wc, PathWithRedundantSlashes)
,
where PathWithRedundantSlashes
is a directory path
containing redundant slashes, such as /tmp/
or
//tmp
, could return incorrect results. (Thanks to
Martin Bjorklund.)
qlc
module. There are two kinds of fast
joins: lookup join that uses existing indices, and merge
join that takes two sorted inputs. There is a new
join
option that can be used to force QLC to use a
particular kind of join in some QLC expression.tmpdir
option of cursor/2
,
eval/2
, fold/4
, and info/2
can be
used to set the directory that join uses for temporary
files. The option also overrides the tmpdir
option
of keysort/3
and sort/2
.lookup
option can be used to
assert that constants are looked up when evaluating some
QLC expression.cache
and cache_all
options
accept new tags: ets
, list
, and no
.
The tag list
caches answers in a list using a
temporary file if the answers cannot be held in RAM.
Combining {cache,list}
and {unique, true}
is equivalent to calling sort/2
with the option
unique
set to true
. The old tags
true
(equivalent to ets
) and false
(equivalent to no
) are recognized for backward
compatibility.max_list_size
can be used
to set the limit where merge join starts to use temporary
files for large equivalence classes and when answers
cached in lists are put on temporary files.is_sorted_key
to
be supplied as an option to table/2
.qlc(3)
for further
details.erl_pp
) is now much
faster when the code is deeply nested. A few minor bugs
have been fixed as well.
lists:prefix/2
and
lists:suffix/2
are documented to only accept lists
as their arguments, but they actually accepted anything
and returned false
. That has been changed so that
the functions cause an exception if one or both arguments
are not lists.string:strip/3
function is documented
to take a character argument that is a character to strip
from one or both ends of the string. Given a list instead
of a character, it used to do nothing, but will now cause
an exception.
c:y/1,2
which call
yecc:file/1,2
are now listed by
c:help/0
.c:y/1,2
has been added to
c(3)
.s
recognizes binaries and deep character lists has been
documented in io(3)
. This feature was added in
R11B-0 (OTP-5403).erl_eval
, which
is used for implementing the restricted mode of the
Erlang shell, did not handle calls to
erlang:apply/3
correctly. This bug has been fixed.
TraverseFun
and
LookupFun
, are now allowed to return a term other
than a list. Such a term is immediately returned as the
results of the current query, and is useful mostly for
returning error tuples.error_logger_file_h
and
error_logger_tty_h
now read the environment
variable utc_log
from the SASL application.ets:info/1
has been corrected to behave according
to the documentation and return a list of tuples, not a
tuple with tuples..hrl
file is included using
-include_lib
, the include path is temporarily
updated to include the directory the .hrl
file was
found in, which will allow that .hrl
file to itself
include files from the same directory as itself using
-include
. (Thanks to Richard Carlsson.)filelib:ensure_dir/1
which sometimes
returned true
and sometimes ok
to always
return ok
when successful. This goes against the
documentation which said true
, but ok
was
judged to be a more logical return value.{Module, Function}(ArgList)
.lists:ukeysort/2
and
lists:ukeymerge/3
have been changed in such a way
that two tuples are considered equal if their keys
match.lists:usort/2
and
lists:umerge/3
have been modified too: two elements
are considered equal if they compare equal.file_sorter
module has been modified in a
similar way: the unique
option now applies to the
key (keysort()
and keymerge()
) and the
ordering function (the option {order, Order}
).ets:update_counter/3
; failure with badarg
also if the counter to be updated is the key.file_sorter
module
and an ordering fun, the sort was not always stable. This
bug has been fixed.
compile
attribute is recognized after
function definitions.nowarn_deprecated_function
can be used for
turning off warnings for calls to deprecated functions.
{nowarn_unused_function,[{Name,Arity}]}
turns off
warnings for unused local functions for the mentioned
functions. The new options
{nowarn_deprecated_function,[{Module,Name,Arity}]}
and {nowarn_bif_clash,[{Name,Arity}]}
work
similarly.epp
now recognizes
the file
attribute. This attribute is meant to be
used by tools such as Yecc that generate source code
files.~s
of io:fwrite
and
io_lib:fwrite
has been extended to handle arguments
that are binaries or I/O lists.p
and P
of the
Format
argument of the functions
io:format/2,3
and io_lib:format/2
have been
changed as to display the contents of binaries containing
printable characters as strings.export
attributes.stdlib(6)
. It
mentions the configuration parameters for the Erlang
shell.zip
module with functions for reading
and creating zip archives. See zip(3)
.dict
instead of a list. This
significantly improves performance when there are many
dynamic supervised child processes. (Thanks to Mickaël
Rémond et al.)strict_record_tests
',
the compiler will generate code that verifies the record
type for 'R#record.field
' operations in guards. Code
that verifies record types in bodies has already been
generated since R10B, but in this release there will be a
'{badrecord,RecordTag}
' instead of a
'badmatch
' if the record verification test fails.
See the documentation for the compile
module for
more information.erl_pp
) now tries to
insert line breaks at appropriate places.public
option has been removed from
digraph:new/1
. The reason is that several
functions in the digraph
module are implemented
using multiple ETS accesses, which is not thread safe.
(Thanks to Ulf Wiger.)lists:keyreplace/4
checks that the
fourth argument (NewTuple
) is a tuple.beam_lib(3)
. (Thanks
to Mats Cronqvist who wrote the example.)warn_unused_record
is used
for finding unused locally defined record types.
shell_default:xm/1
has been added. It calls
xref:m/1
.deprecated
attribute did
not take the compile option export_all
into
account. This bug has been fixed.try/catch
correctly. This bug has been fixed.lists:nthtail/3
.lists:keymap/3
.lists(3)
.timer:now_diff/2
.gen_fsm(3)
,
gen_server(3)
, io_lib(3)
and lib(3)
.
lists.erl
.
erl_expand_records
expands
records in abstract code. It is used by the Erlang shell,
which means that Compiler is no longer used by the shell.
megaco:format_versions/1
function is deprecated.
gen_server:enter_loop
with a
registered server name, it was only checked that the
registered name existed, not that it actually was the
name of the calling process.
beam_lib:version/1
in
documentation.io:read/3
works like
io:read/1,2
but takes a third argument,
StartLine
.gen_fsm:enter_loop/4,5,6
, similar
to gen_server:enter_loop/3,4,5
, has been added.c:i/1
is now exported.
sofs
.-define(S(S), ??S).
' was circular,
which it isn't. (Thanks to Richard Carlsson.)
erl_pp
did not
handle the new 'fun M:F/A
' construct in all
situations. This problem has been fixed.
erts:info/1
has been corrected.erlang:statistics/1
now
lists all possible arguments.fun M:F/A
construct.lists:map(bad_fun, [])
' used to return
'[]
' but now causes an exception.ets
module was removed. (Thanks to Dialyzer.)c:i/0
function will now run in a paged mode if
there are more than 100 processes in the system. (Thanks
to Ulf Wiger.)erlang:system_info(process_count)
has been
optimized and does now return exactly the same value as
length(processes())
. Previously
erlang:system_info(process_count)
did not include
exiting processes which are included in
length(processes())
.+P
flag for erl
, which sets the maximum
number of processes allowed to exist at the same, no longer
accepts values higher than 134217727. (You will still
probably run out of memory before you'll be able to reach
that limit.)
beam_lib
and its
documentation.
erlang:port_info/1
BIF is now documented.
Minor corrections of the documentation for
erlang:port_info/2
.math
module that all functions are not available on all
platforms.+c
' option in
the erl
man page in the ERTS documentation.fun M:F/A
construct creates a fun that
refers to the latest version of M:F/A
. This syntax is
meant to replace tuple funs {M,F}
which have many
problems.is_function(Fun,A)
(which may be
used in guards) test whether Fun
is a fun that can be
applied with A
arguments. (Currently, Fun
can
also be a tuple fun.)
filelib:wildcard/2
was broken (it ignored its
second argument).filelib:wildcard("Filename")
(where the
argument does not contain any meta-characters) would
always return ["Filename"]
. Corrected so that an
empty list will be returned if "Filename"
does not
actually exist. (Same correction in
filelib:wildcard/2
.) (This change is a slight
incompatibility.)filelib:wildcard/1,2
will generate a different
exception when given bad patterns such as "{a,"
. The
exception used to be caused by
'exit(missing_delimiter)
' but is now
'erlang:error({badpattern,missing_delimiter})
'.
encrypt_debug_info
for compiler.
compile
on how to provide the key
for encrypting, and the documentation for beam_lib
on how to provide the key for decryption so that tools such
as the Debugger, xref
, or cover
can be used.
beam_lib:chunks/2
functions now accepts an
additional chunk type compile_info
to retrieve
the compilation information directly as a term. (Thanks
to Tobias Lindahl.)
erl_pp
now correctly pretty-prints fun F/A
.
ets:match/2
. Also clarified that
ets:update_counter/3
updates the counter atomically.
(Thanks to Anders Svensson.)
async_shell_start
and has
been documented. New shells started from the JCL menu are
not syncronized with init
anymore. This makes it
possible to start a new shell (e.g. for debugging purposes)
even if the initial shell has not come up.snmp
module.c:zi/0
has been removed. Use
c:i/0
instead.shell:start_restricted/1
has been used)
would crash the shell evaluator. A debug printout in
gen_fsm
had a clause that would never match; causing
less information to be printed.rpc:yield/1
would crash unless the call
started by rpc:async_call/4
had already finished;
rpc:nb_yield(Key,infinity)
would also crash.erlang:dmonitor_p/2
.
dbg
when tracing to wrap trace files has
been corrected. It failed to delete any already existing
wrap trace files with the same names when starting a new
wrap trace.ordsets:is_set(NoList)
, where NoList
is any
term except a list, would crash. For consistency with
sets:is_set/1
and gb_sets:is_set/1
, it now
returns false
.erlang:raise/3
has been added. See the manual
for details. It is intended for internal system programming
only, advanced error handling.
deprecated
attribute is now checked by the
linter. See xref(3)
for a description of the
deprecated
attribute.
io:format/2
et.al no longer crashes for some
combinations of precision and value for format character
"g". Previously it crashed if the precision P was 4 or lower
and the absolute value of the float to print was lower
than 10^4 but 10^(P-1) or higher. Now it will not crash
depending on the value of the float.gb_sets:del_element/2
was changed to do the
same as gb_sets:delete_any/2
which was the
original intention, not as gb_sets:delete/2
. Code
that relies on gb_sets:del_element/2
causing an
error if the element does not exist must be changed to
call gb_sets:delete/2
instead.gb_sets
, sets
, and
ordsets
was added.
dets:match/1,3
, dets:match_object/1,3
, and
dets:select/1,3
has been reduced. This affects the
amount of data Mnesia sends between nodes while
evaluating QLC queries.
-rsh
switch for starting a remote shell
(introduced with OTP-5210) clashed with an already existing
switch used by slave
. Therefore the switch for
the remote shell is now instead named -remsh
.
-rsh
flag which
gives you a remote initial shell instead of a local one.
Example:erl -sname this_node -rsh other_node@other_hostOwn Id: OTP-5210
lists
module has been updated
with decscription of the new zip
, unzip
,
and partition/2
functions.shell
commands rr/1,2,3
now accepts
wildcards when reading record definitions from BEAM
files.