New EEP draft: Pinning operator ^ in patterns

Eugene e@REDACTED
Fri Jan 22 18:46:01 CET 2021


On 1/22/21 5:27 PM, Raimo Niskanen wrote:
> On Fri, Jan 22, 2021 at 01:22:02PM +0100, Eugene wrote:
>> On 1/22/21 9:25 AM, Richard Carlsson wrote:
>>> In many normal cases, the ^-annotation can look superfluous.
>>
>> show me an example where annotating an *UNbound* var
>> is not useful.
> 
> foo() ->
>      ^A = 2,
>      A.
> 
> If that is what you ment; annotating every time a new variable is bound
> is not practical, because binding is much more common than using
> a variable in pattern matching.

using a variable in general is much more common than binding,
and it is easier to read a plain mention "Variable"
regardless of context.

you can omit "^"
if you consider a match too obvious.

however!

you example shows us that the ENTIRETY OF THE SCOPE
is required to make it known that "A" was not bound earlier.


More information about the eeps mailing list