Re: New EEP draft: Pinning operator ^ in patterns

Kostis Sagonas <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <[email protected]>
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?

Cheers,
Kostis








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: http://www.uu.se/om-uu/dataskydd-personuppgifter/

E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here: http://www.uu.se/en/about-uu/data-protection-policy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.