New EEP draft: Pinning operator ^ in patterns

zxq9 zxq9@REDACTED
Fri Dec 25 06:09:18 CET 2020


Looking at this from the perspective of having to read other people's 
code quite a lot, I am pretty unexcited about any changes that would 
introduce glyphy anotations to variable names or move even slightly in 
the direction of allowing rebinding.

Few long-time Erlangers would ever feel a desire to use a feature like 
this, but people who have no idea how the paradigm works are very likely 
to overuse it to a fault, making code a nightmare to sort through. This 
particular change with the ^ isn't so bad (but why not just use a new 
name? Y becomes Y1 or NewY or NextY instead of ^Y? I usually prefer 
something that is at least *descriptive* anyway like PopulatedY or 
FilteredY or whatever. The keystrokes are free...) but again, moving in 
the direction of rebinding is really pushing things in a crazy direction.

I find Erlang's approach to strict single assignment one of its greatest 
benefits because I can sort through convoluted code written by newcomers 
*much* faster than I can in most other languages specifically because I 
can know for certain where a value came from at a glance.

-Craig

On 2020/12/25 7:36, Tristan Sloughter wrote:
> I'd much prefer if `^` was used to allow rebinding. But I know that 
> would be too confusing since Elixir went with ^ to mean regular binding. 
> So maybe `!`?
> 
> But this change just lets you add the `^` while not changing how 
> anything works? That sounds like it'll cause a lot of confusion when 
> reading since sometimes a bind is using `^` and sometimes they aren't 
> but it is doing the same thing...


More information about the erlang-questions mailing list