aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib
AgeCommit message (Collapse)Author
2018-05-08Remove comments about deprecation in OTP-21dgud-string-deprDan Gudmundsson
I had missed the one in lower section.
2018-05-08Merge pull request #1801 from dtip/update-global-name-specHans Bolinder
Update global name typespec
2018-05-07Merge pull request #1802 from michalmuskala/map-is-key-bifBjörn Gustavsson
Introduce is_map_key/2 guard BIF OTP-15037
2018-05-02Revert "Update release notes"Henrik
This reverts commit 202bb737e3deabfebee683266f4b7c42781eb521.
2018-05-02Revert "Update version numbers"Henrik
This reverts commit 345f7f527a4c26ef49cef0d81e2c8b71bf01ebc3.
2018-04-30Update release notesErlang/OTP
2018-04-30Update version numbersErlang/OTP
2018-04-29Introduce is_map_key/2 guard BIFMichał Muskała
This complements the `map_get/2` guard BIF introduced in #1784. Rationale. `map_get/2` allows accessing map fields in guards, but it might be problematic in more complex guard expressions, for example: foo(X) when map_get(a, X) =:= 1 or is_list(X) -> ... The `is_list/1` part of the guard could never succeed since the `map_get/2` guard would fail the whole guard expression. In this situation, this could be solved by using `;` instead of `or` to separate the guards, but it is not possible in every case. To solve this situation, this PR proposes a `is_map_key/2` guard that allows to check if a map has key inside a guard before trying to access that key. When combined with `is_map/1` this allows to construct a purely boolean guard expression testing a value of a key in a map. Implementation. Given the use case motivating the introduction of this function, the PR contains compiler optimisations that produce optimial code for the following guard expression: foo(X) when is_map(X) and is_map_key(a, X) and map_get(a, X) =:= 1 -> ok; foo(_) -> error. Given all three tests share the failure label, the `is_map_key/2` and `is_map/2` tests are optimised away. As with `map_get/2` the `is_map_key/2` BIF is allowed in match specs.
2018-04-27Update global name typespecDaniel Tipping
2018-04-27Merge branch 'siri/kernel/logger/OTP-13295'Siri Hansen
* siri/kernel/logger/OTP-13295: Add documentation of the built-in logger handlers Catch badarg in logger:get_format_depth/0 Add chars_limit option to logger_formatter Don't kill logger process until all other processes are dead Set call timeout for logger_server to infinity Update primary bootstrap Test cuddle for logger Update cth_log_redirect to a logger handler Start using logger internally in kernel and stdlib Remove error_logger process and add logger process Add logger
2018-04-27Merge branch 'hasse/stdlib/rfc3339_datetime/OTP-14764'Hans Bolinder
* hasse/stdlib/rfc3339_datetime/OTP-14764: stdlib: Add RFC 3339 functions to module calendar
2018-04-26Update appups in kernel, stdlib and sasl for OTP-21.0Siri Hansen
2018-04-26[stdlib/sys]: install one debug function more times (#1781)Pouriya
Allow installing multiple instances of sys debug function This commit solves a bug which allowed installing {Fun,State} as sys debug function even if Fun was already installed. This happened in the case when the current State of the debug fun was undefined. Also, the new format {Id,Fun,State} of debug functions can be installed, allowing multiple instances of the same fun.
2018-04-26Merge pull request #1759 from sunboshan/sys-fixSiri Hansen
[stdlib/sys.erl] Fix sys module's debug statistics not including the out message count when using gen_server:call/2. OTP-15047
2018-04-26stdlib: Add RFC 3339 functions to module calendarHans Bolinder
Functions for converting between RFC 3339 strings and system time are added. Options are lists, but we are considering using maps instead. If we change, it will happen after Erlang/OTP 21.0-rc1 is released.
2018-04-26Merge branch 'hasse/stdlib/calendar_systemtime/OTP-13413'Hans Bolinder
* hasse/stdlib/calendar_systemtime/OTP-13413: stdlib: Add system time functions to module calendar
2018-04-26Test cuddle for loggerSiri Hansen
2018-04-26Start using logger internally in kernel and stdlibSiri Hansen
2018-04-25stdlib: Modify the printing of map associations with wWpPHans Bolinder
Use the same depth for all (printed) elements of a map. Since the order of keys can vary when printing a map--maps:iterator/1 and maps:next/1 are used--it is more consistent to print all associations with the same depth. If the associations printed are limited by the depth, the selection of associations is arbitrary, as before.
2018-04-25stdlib: Introduce characters limit of formated stringsHans Bolinder
Inspiration from module lager_format. Also some improvements of Unicode handling. io_lib:format/3 and io_lib:fwrite/3 are new functions. The representation of the options is a list, but we are considering using a map instead. If we change, it will happen after Erlang/OTP 21.0-rc1 is released.
2018-04-25stdlib: Modify ~w/~W when number of characters is limitedHans Bolinder
A bug fix: limited maps end with "...", not "...=>...". A modification: wW separate pairs with " => ", not "=>". When the output is limited on number of characters, the term is balanced by wW the same way as is done with pP (see commit bc38638).
2018-04-25stdlib: io_lib{_pretty}: Avoid tuple_to_list when possibleHans Bolinder
2018-04-25stdlib: Introduce characters limit of formatted stringsHans Bolinder
The name of the io_lib_pretty:print/2 option 'max_chars' is changed to 'line_max_chars' (used by module shell only). The new option for limiting the number of returned characters of io_lib_pretty:print() is called 'chars_limit'.
2018-04-25Merge branch 'hasse/stdlib/map_guards_shell/OTP-15035/ERL-613'Hans Bolinder
* hasse/stdlib/map_guards_shell/OTP-15035/ERL-613: erts: Correct abstract format doc regarding map creation stdlib: Correct the linter's check of map guard expressions
2018-04-25Merge branch 'map-get-bif' of git://github.com/michalmuskala/otpBjörn Gustavsson
* 'map-get-bif' of git://github.com/michalmuskala/otp: Introduce map_get guard-safe function OTP-15037
2018-04-24stdlib: Correct the linter's check of map guard expressionsHans Bolinder
The check is used by evaluating modules such as erl_eval. An example: "if map_size(#{}) =:= 0 -> ok end.".
2018-04-24Merge branch 'raimo/stdlib/gen_statem-dev/OTP-14015'Raimo Niskanen
* raimo/stdlib/gen_statem-dev/OTP-14015: Fix after feedback Improve pointer to User's Guide Fix after feedback on 'When to use' Add a 'When to use' section Fix timeout parsing and doc feedback Improve doc, change images to .svg erl_docgen: Implement width in image tag Update User's Guide and pointers to it Improve error reasons from state enter call
2018-04-24Introduce map_get guard-safe functionMichał Muskała
Rationale Today all compound data types except for maps can be deconstructed in guards. For tuples we have `element/2` and for lists `hd/1` and `tl/1`. Maps are completely opaque to guards. This means matching on maps can't be abstracted into macros, which is often done with repetitive guards. It also means that maps have to be always selected whole from ETS tables, even when only one field would be enough, which creates a potential efficiency issue. This PR introduces an `erlang:map_get/2` guard-safe function that allows extracting a map field in guard. An alternative to this function would be to introduce the syntax for extracting a value from a map that was planned in the original EEP: `Map#{Key}`. Even outside of guards, since this function is a guard-BIF it is more efficient than using `maps:get/2` (since it does not need to set up the stack), and more convenient from pattern matching on the map (compare: `#{key := Value} = Map, Value` to `map_get(key, Map)`). Performance considerations A common concern against adding this function is the notion that "guards have to be fast" and ideally execute in constant time. While there are some counterexamples (`length/1`), what is more important is the fact that adding those functions does not change in any way the time complexity of pattern matching - it's already possible to match on map fields today directly in patterns - adding this ability to guards will niether slow down or speed up the execution, it will only make certain programs more convenient to write. This first version is very naive and does not perform any optimizations.
2018-04-23Fix sys's debug statistics.Boshan Sun
Currently, in sys:stat/2, the message out only count for system events with format {out, Msg, To}. However, the gen_server:reply/5 will call sys:handle_debug/4 with format {out, Reply, To, State}. That will make the message out count fail to pattern matching. Also update sys_SUITE.erl and relevant docs.
2018-04-21stdlib: Add system time functions to module calendarHans Bolinder
2018-04-20erts: Use table ref for select continuationSverker Eriksson
and not the name. For more sane named table semantics. Applies to both select/1 continuation and trap context.
2018-04-20Merge pull request #1783 from bjorng/bjorn/deprecate-get_stacktrace/OTP-14692Björn Gustavsson
Deprecate erlang:get_stacktrace/1
2018-04-18Improve pointer to User's GuideRaimo Niskanen
2018-04-17Fix after feedback on 'When to use'Raimo Niskanen
2018-04-16Remove warnings for improper use of erlang:get_stacktrace/0Björn Gustavsson
Those warnings don't make sense any more since erlang:get_stacktrace/0 is now deprecated.
2018-04-16Deprecate erlang:get_stacktrace/0Björn Gustavsson
2018-04-13Add zzz_SUITE with erts_debug:lc_graph last in testsSverker Eriksson
for erts, stdlib, kernel and runtime_tools.
2018-04-12Fix timeout parsing and doc feedbackRaimo Niskanen
2018-04-10stdlib: Fix timer monotonic time linkLukas Larsson
2018-04-09erl_docgen: Add ghlink step for all non-generated doc xml filesLukas Larsson
In order to get line numbers into the ghlink we have to add a post processing step for all xml files.
2018-04-08Reflect actual timer:tc behaviour in documentationTobias Pfeiffer
It was switched to monotnic_time from timestamp 3 years ago in d927209aa36fe370eb4ecf0a081923b0b951458b
2018-04-04Merge pull request #1725 from michalmuskala/fun-literalsBjörn Gustavsson
Compile external fun expressions to literals OTP-15003
2018-03-28stdlib: Remove reference to inets:ftp in erl_tar.xmlPéter Dimitrov
Change-Id: I5328d5feeac3b7279a8770e8fc27e2d9e8eed359
2018-03-27Merge branch 'dgud/revert-string-depr'Dan Gudmundsson
* dgud/revert-string-depr: Revert "Deprecate old string functions"
2018-03-26Compile external fun expressions to literalsMichał Muskała
The expressions fun M:F/A, when all elements are literals are also treated as a literal. Since they have consistent representation and don't depend on the code currently loaded in the VM, this is safe. This can provide significant performance improvements in code using such functions extensively - a full function call to erlang:make_fun/3 is replaced by a single move instruction and no register shuffling or saving registers to stack is necessary. Additionally, compound data types that contain such external functions as elements can be treated as literals too. The commit also changes the representation of external funs to be a valid Erlang syntax and adds support for literal external funs to core Erlang.
2018-03-26Merge branch 'raimo/type-posix-0-overhaul/ERL_550/OTP-14019'Raimo Niskanen
* raimo/type-posix-0-overhaul/ERL_550/OTP-14019: Update types for posix error codes
2018-03-26Update types for posix error codesRaimo Niskanen
I have read the man pages for most socket and file operations on recent Linux, FreeBSD, OpenBSD and Solaris 10 and noted the possible error codes. Which error codes that are possible for file operations have been updated in file:posix/0. Error codes for socket operations in inet:posix/0. The latter refers to the former so it is a superset, assuming that e.g sendfile and AF_UNIX socket operations could cause socket operations to return any file error code. That is not entirely true, but could be, especially in the future. Added to file:posix/0 are: ebadmsg edeadlk edeadlock eftype emultihop enobufs enolck enolink enosr enostr enosys eopnotsupp eoverflow erange etxtbsy Added to inet:posix/0 are all but: exbadport exbadseq file:posix() These are still possible according to erl_posix_str.c, but are not in file:posix/0 nor in inet:posix/0, and many of them are not file nor inet related, but some might be: e2big eadv ealign ebade ebadfd ebadr ebadrpc ebadrqc ebadslt ebfont echild echrng ecomm edirty edom edotdot eduppkg eidrm einit eisnam elbin el2hlt el2nsync el3hlt el3rst elibacc elibbad elibexec elibmax elibscn elnrng enavail enet enoano enocsi enodata enoexec enonet enosym enotempty enotnam enotuniq eproclim eprocunavail eprogmismatch eprogunavail erefused eremchg eremdev eremote eremoteio eremoterelease erpcmismatch erremote eshutdown esrmnt esuccesss etime etoomanyrefs euclean eunatch eusers eversion exfull sysnotready vernotsupported ediscon enomore ecancelled einvalidproctable einvalidprovider eproviderfailedinit syscallfailure service_not_found type_not_found e_no_more e_cancelled unknown
2018-03-26Merge pull request #1703 from juhlig/masterHans Bolinder
[ERL-557] add is_empty/1 to sets and ordsets OTP-14996, ERL-557, PR-1703
2018-03-23tests for is_empty/1j.uhlig
2018-03-22Revert "Deprecate old string functions"Dan Gudmundsson
It has been decided that it was to early to deprecate the old string functions. This partially reverts commit ccb3f7f9768d3c28783c771df47eec1829e51802.