Age | Commit message (Collapse) | Author | |
---|---|---|---|
2013-12-12 | EEP 37: Funs with names | Anthony 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-25 | Update copyright years | Björn-Egil Dahlberg | |
2013-01-25 | Make adjustments for Unicode | Hans Bolinder | |
2012-01-26 | Remove support for is_constant/1 in ms_transform | Björn Gustavsson | |
2011-09-08 | ms_transform: Fix incorrect `variable shadowed' warnings | Haitao Li | |
Compile below module resulting incorrect warning: $ cat tmp.erl -module(tmp). -export([tmp/1]). -include_lib("stdlib/include/ms_transform.hrl"). tmp(X) when X > 100 -> Y=X, Y; tmp(X) -> ets:fun2ms(fun(Y) -> {X, Y} end). $ erlc tmp.erl ./tmp.erl:8: Warning: variable 'Y' shadowed in ms_transform fun head The scope for a variable is its function clause. Variables bound in one function clause should not interfere with other function clauses. This patch removes incorrect passing of variable bindings from one function clause to another. Signed-off-by: Haitao Li <[email protected]> | |||
2011-05-12 | Types and specifications have been modified and added | Hans Bolinder | |
2011-03-11 | Update copyright years | Björn-Egil Dahlberg | |
2010-06-23 | Add testcases for ms_transform warning and fix scoping | Patrik Nyblom | |
2010-06-23 | Add warnings for shadowed variables in ms_transform funs | Patrik Nyblom | |
Also changed compiler to allow for warnings in parse_transforms. | |||
2009-11-20 | The R13B03 release.OTP_R13B03 | Erlang/OTP | |