New EEP draft: Pinning operator ^ in patterns

Kostis Sagonas kostis@REDACTED
Wed Jan 20 16:22:26 CET 2021

On 1/20/21 3:42 PM, Raimo Niskanen wrote:
> I have vague feeling that this has been asked,
> but since I can not find it:
> How is nested fun()s handled?
> foo(Y) ->
>      F = fun (X) ->
>           Y = X + ^Y,
>           FF = fun (Z) ->
>                    Z + ^Y
>                end,
>           FF(Y)
>          end,
>      F(Y).
> Does the innermost Z + ^Y access the outermost Y from foo(Y), or the Y
> bound in F/1 i.e Y = X + ^Y?
> Is there a way to choose which of the outer Y:s to refer to from within FF/1?

Raimo: Your question about nested funs is a good one.

However, I thought that ^ was meant to be used in *patterns* (this is
even in the subject of this sad thread), and I do not see ^ being used
in patterns in your example.

Am I missing anything?

Are you still of the opinion that this, supposedly "pinning operator"
(which is neither "pinning" anything nor an "operator") makes Erlang
less confusing a language?


När du har kontakt med oss på Uppsala universitet med e-post så innebär det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du läsa här:

E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here:

More information about the erlang-questions mailing list