[erlang-patches] EEP37: Funs with names

Pedram Nimreezi <>
Wed Mar 20 09:53:18 CET 2013


+1 This is an especially useful console enhancement that allows
anonymous function recursion...

On Wed, Mar 20, 2013 at 4:38 AM, Anthony Ramine <> wrote:
> Will someone ever review this, pretty please with sugar on top?
>
> It was postponed for R16A; could you tell me if it can be included in R17?
>
> Regards,
>
> --
> Anthony Ramine
>
> Le 5 févr. 2013 à 13:51, Anthony Ramine a écrit :
>
>> Hi,
>>
>> Rebased against latest master—which I gather is now for R17. Please refetch.
>>
>> Regards,
>>
>> --
>> Anthony Ramine
>>
>> Le 21 nov. 2012 à 15:36, Anthony Ramine a écrit :
>>
>>> Hi,
>>>
>>> I had forgotten to update the abstract format documentation, named_fun is
>>> now mentioned in absform.xml in the doc commit.
>>>
>>> Please refetch,
>>>
>>> --
>>> Anthony Ramine
>>>
>>> Le 15 nov. 2012 à 15:22, Henrik Nord a écrit :
>>>
>>>> I will add this patch to 'master-pu'.
>>>>
>>>> Thank you for your contribution!
>>>>
>>>>
>>>> On 2012-11-14 17:42, Anthony Ramine wrote:
>>>>> This patch implements EEP37: Funs with names
>>>>>
>>>>> 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.
>>>>>
>>>>>    https://github.com/nox/otp/compare/erlang:master...eep37
>>>>>    https://github.com/nox/otp/compare/erlang:master...eep37.patch
>>>>>
>>>>>    git fetch https://github.com/nox/otp eep37
>>>>>
>>>>> Regards,
>>>>>
>>>>
>>>> --
>>>> /Henrik Nord Erlang/OTP
>>>>
>>>
>>
>
> _______________________________________________
> erlang-patches mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-patches



-- 
/* Sincerely
--------------------------------------------------------------
Pedram Nimreezi - Chief Technology Officer  */

// The hardest part of design … is keeping features out. - Donald Norman


More information about the erlang-patches mailing list