aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/examples/erl_id_trans.erl
AgeCommit message (Collapse)Author
2016-04-28erl_parse: Add parsing for new map type syntaxMagnus Lång
erl_types typesets mandatory keys with :=, and uses "..." as a shorthand for "any() => any()". Add these to erl_parse so that all representable types can be written in type-specs.
2016-02-17stdlib: Update erl_id_trans to handle types and specsHans Bolinder
2015-06-18Change license text to APLv2Bruce Yinhe
2014-04-03stdlib: Fix erl_id_trans exampleBjörn-Egil Dahlberg
2014-01-28stdlib: Fixup id_transform_SUITEBjörn-Egil Dahlberg
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-01-16Remove support for the query keyword and query expressionsLoïc Hoguin
2012-08-17Remove support for tuple funsBjörn Gustavsson
Tuple funs were deprecated in R15B (in commit a4029940e309518f5500).
2011-11-07EEP-23: Allow variables in fun M:F/ABjörn Gustavsson
Currently, the external fun syntax "fun M:F/A" only supports literals. That is, "fun lists:reverse/1" is allowed but not "fun M:F/A". In many real-life situations, some or all of M, F, A are not known until run-time, and one is forced to either use the undocumented erlang:make_fun/3 BIF or to use a "tuple fun" (which is deprecated). EEP-23 suggests that the parser (erl_parse) should immediately transform "fun M:F/A" to "erlang:make_fun(M, F, A)". We have not followed that approach in this implementation, because we want the abstract code to mirror the source code as closely as possible, and we also consider erlang:make_fun/3 to be an implementation detail that we might want to remove in the future. Instead, we will change the abstract format for "fun M:F/A" (in a way that is not backwards compatible), and while we are at it, we will move the translation from "fun M:F/A" to "erlang:make_fun(M, F, A)" from sys_pre_expand down to the v3_core pass. We will also update the debugger and xref to use the new format. We did consider making the abstract format backward compatible if no variables were used in the fun, but decided against it. Keeping it backward compatible would mean that there would be different abstract formats for the no-variable and variable case, and tools would have to handle both formats, probably forever. Reference: http://www.erlang.org/eeps/eep-0023.html
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP