aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib
AgeCommit message (Collapse)Author
2013-12-12Test named funsAnthony Ramine
2013-12-12Support named funs in the shellAnthony Ramine
The current code for the evaluation of ordinary funs is dependent on the order on variables in the fun environment as returned by erlang:fun_info(Fun, env). To avoid the problem in the future, make sure that we only have one free variable in the funs that we will need to inspect using erlang:fun_info(Fun, env).
2013-12-12EEP 37: Funs with namesAnthony Ramine
This adds optional names to fun expressions. A named fun expression is parsed as a tuple `{named_fun,Loc,Name,Clauses}` in erl_parse. If a fun expression has a name, it must be present and be the same in every of its clauses. The function name shadows the environment of the expression shadowing the environment and it is shadowed by the environment of the clauses' arguments. An unused function name triggers a warning unless it is prefixed by _, just as every variable. Variable _ is allowed as a function name. It is not an error to put a named function in a record field default value. When transforming to Core Erlang, the named fun Fun is changed into the following expression: letrec 'Fun'/Arity = fun (Args) -> let <Fun> = 'Fun'/Arity in Case in 'Fun'/Arity where Args is the list of arguments of 'Fun'/Arity and Case the Core Erlang expression corresponding to the clauses of Fun. This transformation allows us to entirely skip any k_var to k_local transformation in the fun's clauses bodies.
2013-12-10Merge tag 'OTP_R16B03'Magnus Lidén
The R16B03 release Conflicts: lib/sasl/vsn.mk
2013-12-09Prepare releaseOTP_R16B03Erlang/OTP
2013-12-07Merge branch 'rickard/garbage_collect/OTP-11388'Rickard Green
* rickard/garbage_collect/OTP-11388: Parallel check_process_code when code_server purge a module Functionality for disabling garbage collection Use asynchronous check_process_code in code_parallel_SUITE Execution of system tasks in context of another process Conflicts: bootstrap/lib/kernel/ebin/hipe_unified_loader.beam erts/preloaded/ebin/erlang.beam erts/preloaded/ebin/erts_internal.beam
2013-11-18Execution of system tasks in context of another processRickard Green
A process requesting a system task to be executed in the context of another process will be notified by a message when the task has executed. This message will be on the form: {RequestType, RequestId, Pid, Result}. A process requesting a system task to be executed can set priority on the system task. The requester typically set the same priority on the task as its own process priority, and by this avoiding priority inversion. A request for execution of a system task is made by calling the statically linked in NIF erts_internal:request_system_task(Pid, Prio, Request). This is an undocumented ERTS internal function that should remain so. It should *only* be called from BIF implementations. Currently defined system tasks are: * garbage_collect * check_process_code Further system tasks can and will be implemented in the future. The erlang:garbage_collect/[1,2] and erlang:check_process_code/[2,3] BIFs are now implemented using system tasks. Both the 'garbage_collect' and the 'check_process_code' operations perform or may perform garbage_collections. By doing these via the system task functionality all garbage collect operations in the system will be performed solely in the context of the process being garbage collected. This makes it possible to later implement functionality for disabling garbage collection of a process over context switches. Newly introduced BIFs: * erlang:garbage_collect/2 - The new second argument is an option list. Introduced option: * {async, RequestId} - making it possible for users to issue asynchronous garbage collect requests. * erlang:check_process_code/3 - The new third argument is an option list. Introduced options: * {async, RequestId} - making it possible for users to issue asynchronous check process code requests. * {allow_gc, boolean()} - making it possible to issue requests that aren't allowed to garbage collect (operation will abort if gc should be needed). These options have been introduced as a preparation for parallelization of check_process_code operations when the code_server is about to purge a module.
2013-11-07Merge branch 'maint'Fredrik Gustafsson
2013-11-07Merge branch 'asterite/atan2_spec/OTP-11465' into maintFredrik Gustafsson
* asterite/atan2_spec/OTP-11465: Spec for atan2 should be atan2(Y, X), not atan2(X, Y)
2013-10-29Merge branch 'maint'Fredrik Gustafsson
2013-10-25Add XML marker for regexp syntaxHåkan Mattsson
2013-10-22Merge branch 'mh/dict_orddict_is_empty/OTP-11353'Fredrik Gustafsson
* mh/dict_orddict_is_empty/OTP-11353: Update primary bootstrap Add dict:is_empty/1 and orddict:is_empty/1
2013-10-16Spec for atan2 should be atan2(Y, X), not atan2(X, Y)Ary Borenszweig
2013-10-15Merge branch 'maint'Fredrik Gustafsson
2013-10-15Merge branch 'blt/gen_server-typo/OTP-11398' into maintFredrik Gustafsson
* blt/gen_server-typo/OTP-11398: Change 'recive' to 'receive' in gen_server.erl
2013-10-14Merge branch 'maint'Fredrik Gustafsson
2013-10-14Merge branch 'fenollp/treewide_remove_unexpected_0xff/OTP-11323' into maintFredrik Gustafsson
* fenollp/treewide_remove_unexpected_0xff/OTP-11323: Remove ^L characters hidden randomly in the code. Not those used in text files as delimiters.
2013-10-12Change 'recive' to 'receive' in gen_server.erlBrian L. Troutwine
A small spelling correction merely; no functionality change.
2013-09-30Merge branch 'maint'Fredrik Gustafsson
2013-09-30Merge branch 'msassak/empty-pattern-badarg/OTP-11350' into maintFredrik Gustafsson
* msassak/empty-pattern-badarg/OTP-11350: stdlib: extended binary_module_SUITE to assure badarg for OTP-11350 Check all pattern arguments passed to binary:matches/2
2013-09-25stdlib: extended binary_module_SUITE to assure badarg for OTP-11350Fredrik Gustafsson
2013-09-24Update version numbers for R16B03 developmentFredrik Gustafsson
2013-09-19Teach erlc to handle UTF-8 file namesBjörn Gustavsson
The 'erlc' program passes options to the 'erl' program using the '-s' option. The '-s' option causes all options to be converted to atoms, which implies that UTF-8 file names may not be given on the command line. We could solve just the UTF-8 problem by using '-run' and change the erl_compile module to expect strings instead of atoms, but since that is an incompatible change, we should take the opportunity to make more incompatible changes while we are at it. Specifically, when 'erlc' was first written, there was no way to pass command line arguments starting with '-' to Erlang, so 'erlc' did all parsing of arguments and translated options to atoms starting with a '@' character (for example, -I was translated to @i). Since then, the '-extra' option has been introduced which allows us to pass anything to Erlang at the end of the command line. Therefore, while at it, do the minimum of necessary command line parsing in the 'erlc' program (e.g. the '-smp' option), passing the command line essentially unchanged to 'erl' using the '-extra' option, and rewrite the option parsing in Erlang.
2013-09-17Merge tag 'OTP_R16B02'Magnus Lidén
The R16B02 release Conflicts: lib/sasl/vsn.mk
2013-09-16Prepare releaseOTP_R16B02Erlang/OTP
2013-09-13Add dict:is_empty/1 and orddict:is_empty/1Magnus Henoch
dict:size/1 runs in constant time, but orddict:size/1 does not. With this change, the two modules stay API compatible and gain a constant-time function for checking whether a dictionary is empty.
2013-09-12Remove ^L characters hidden randomly in the code. Not those used in text ↵Pierre Fenoll
files as delimiters. While working on a tool that processes Erlang code and testing it against this repo, I found out about those little sneaky 0xff. I thought it may be of help to other people build such tools to remove non-conforming-to-standard characters.
2013-09-09Merge branch 'bjorn/xml-encoding-fix/OTP-11310' into maintBjörn Gustavsson
* bjorn/xml-encoding-fix/OTP-11310: Change encoding of troublesome notes.xml files to utf-8 Convert some notes.xml files from latin-1 to utf-8
2013-09-06Change encoding of troublesome notes.xml files to utf-8Björn Gustavsson
Most notes.xml files will be updated in every release and cause the kind of the problems described in the previous commit.
2013-09-06Merge branch 'maint'Fredrik Gustafsson
Conflicts: bootstrap/lib/stdlib/ebin/erl_lint.beam
2013-08-27Fix variable usage tracking in some record errorsAnthony Ramine
When reporting a field redefinition in a record, erl_lint can forget about some old unused variables. f() -> X = 1, #r{a=foo,a=bar,a=qux}.
2013-08-27Fix unsafe variable tracking in try expressionsAnthony Ramine
Variables used in the body of a try expression were marked as unsafe *and* used, which makes no sense as an unsafe variable can't be used. Function vtsubtract/2 is used to forget usage of such unsafe variables. Reported-by: Paul Davis
2013-08-27Fix variable usage tracking in erl_lintAnthony Ramine
When analyzing complex expressions (i.e. comprehensions, cases, tries, ifs and receives), erl_lint does not forget about old unused variables when returning the updated variable table. This causes a bug where old unused variables are not recorded as such: t(X, Y) -> #r{a=[ K || K <- Y ],b=[ K || K <- Y ]}. As erl_lint uses vtmerge_pat/2 to merge the results of the analysis of the two list comprehensions, X is marked as used and the warning is not emitted. The function vtmerge_pat/2 is used instead of the similar vtmerge/2 which does not mark multiple occurrences of a variable as usage to handle cases like the following one: t(X, Y) -> #r{a=A=X,b=A=Y}. Other simpler expressions like conses, tuples and external fun references do not correctly follow this behaviour, e.g. A is not marked as used in the following code: t(X, Y) -> {A=X,A=Y}. This commit fixes both issues and makes erl_lint not return old unused variables in updated tables and makes all compound expressions use vtmerge_pat/2. Reported-by: Anders Ramsell
2013-08-26Merge branch 'maint'Fredrik Gustafsson
2013-08-26Merge branch 'sze/edlin_understand_keys/OTP-11251' into maintFredrik Gustafsson
* sze/edlin_understand_keys/OTP-11251: Added primary bootstrap erts: fixed documentation regarding tty and arrow keys make edlin understand a few important control keys
2013-08-26Merge branch 'maint'Fredrik Gustafsson
2013-08-26Merge branch 'alexrp/export_edge/OTP-11266' into maintFredrik Gustafsson
* alexrp/export_edge/OTP-11266: Export the edge/0 type from the digraph module
2013-08-22Merge branch 'maint'Hans Bolinder
* maint: Correct the specifications of io_lib:fread/2,3
2013-08-21Correct the specifications of io_lib:fread/2,3Hans Bolinder
Thanks to Chris King and Kostis Sagonas for pinpointing the bug.
2013-08-21Merge branch 'maint'Hans Bolinder
* maint: Fix a Dets bug concerning traversal of tables
2013-08-21Merge branch 'hb/stdlib/dets_bugfix/OTP-11245' into maintHans Bolinder
* hb/stdlib/dets_bugfix/OTP-11245: Fix a Dets bug concerning traversal of tables
2013-08-21Merge branch 'maint'Hans Bolinder
* maint: Fix a bug in the linter regarding the 'fun M:F/A' construct
2013-08-20Fix a bug in the linter regarding the 'fun M:F/A' constructHans Bolinder
If the fun M:F/A construct was used erroneously the linter could crash. Thanks to Mikhail Sobolev for reporting the bug.
2013-08-19Fix a Dets bug concerning traversal of tablesHans Bolinder
The bug was introduced in R16B. Thanks to Manuel Durán Aguete.
2013-08-16Merge branch 'pan/update_pcre_8.33'Patrik Nyblom
* pan/update_pcre_8.33: Workaround TR gnu/181328, GCC 4.2.1 20070831 on FreeBSD 9.1 Clarify relation between erts_iolist_{size|to_buf} Fix backslash in titles of manpages Correct UTF-8 in stdlib's notes.xml Add more tests for corner error cases in erl_bif_re.c Add documentation of report_errors and match_limit(_recursion) Add match_limit and match_limit_recursion options Add return_errors option to re:run/3 Add README for updating PCRE Add documentation of extensions to re module Add new options to Erlang re interface and mend dupnames Update PCRE doc part of re.xml to PCRE 8.33 state Integrate new PCRE test suites Integrate patch for PCRE bug id 1370 Handle CRLF correctly in global regexp Add erts_prefix to pcre_library and update erl_bif_re Update to PCRE 8.33, w/o the erts_ prefix added OTP-11204 OTP-11205 OTP-10285
2013-08-09Correct UTF-8 in stdlib's notes.xmlPatrik Nyblom
2013-08-09Add more tests for corner error cases in erl_bif_re.cPatrik Nyblom
2013-08-09Add documentation of report_errors and match_limit(_recursion)Patrik Nyblom
2013-08-09Add match_limit and match_limit_recursion optionsPatrik Nyblom
Added to re:run and sets the corresponding fields in 'extra' struct for the PCRE match engine. The result can be viewed by also setting 'report_errors' when matching. Some housekeeping was also done... The offset option also did not properly check for offset's >= 0. Change nomatch to BADARG when pre-compiled mp() is faked: By constructing a 5-tuple with faked content but the right data types, you could do a re:run which returned nomatch when in fact the mp() was bad. The cheapest solution is to check the return from pcre_exec better. Remove unreachable code in erts_bif_re.c: Replaced tests for things that logically simply cannot happen with ASSERT.
2013-08-09Add return_errors option to re:run/3Patrik Nyblom