New EEP draft: Pinning operator ^ in patterns

zxq9 zxq9@REDACTED
Fri Jan 29 00:23:45 CET 2021


On 2021/01/29 7:31, Michael P. wrote:
> :-)
> 
>> Den tors 28 jan. 2021 kl 15:38 skrev Coconut <c0c0nut@REDACTED>:
> 
>> changing other scoping rules either, in either direction, in a way that
>> preserves compatibility. That in turn limits a lot of other things.
> 
> Scoping is easy:
> 
> Every pattern, apart from LHS `=`, opens a new scope.

...except for the most common pattern matching situation of all: `case`

Not having anonymous function heads and list comprehension iterators 
follow the way patterns work in case is jarring and probably the main 
thing I get confused looks from learners over. "Wait, why *just here* we 
can shadow a variable? Shouldn't it be the same as everywhere?"

One Scope To Rule Them All is the cognitively consistent approach 
because closures exist.

-Craig


More information about the erlang-questions mailing list