[erlang-patches] EEP37: Funs with names

Fredrik fredrik@REDACTED
Wed Mar 20 10:31:12 CET 2013


On 03/20/2013 09:53 AM, Pedram Nimreezi wrote:
> +1 This is an especially useful console enhancement that allows
> anonymous function recursion...
>
> On Wed, Mar 20, 2013 at 4:38 AM, Anthony Ramine<n.oxyde@REDACTED>  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
>> erlang-patches@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-patches
>
>
Hello,
To get the patch going in pu,
Could you rebase it upon the current 'maint' branch.

-- 

BR Fredrik Gustafsson
Erlang OTP Team




More information about the erlang-patches mailing list