New EEP draft: Pinning operator ^ in patterns

Igor Clark igor.clark@REDACTED
Fri Dec 25 13:24:58 CET 2020


Hello,

Just to give a flavour from a relative newcomer compared to others responding here, I think the simplicity of Erlang-the-language is a huge benefit, and I’d love to avoid what I can’t help seeing as ambiguities, even when intended to clarify.

I’ve only been writing Erlang in anger for maybe 4 years spread over the last 10, and haven’t written large libraries myself, but I’ve never had an instance in my code where the kind of rebinding issue mentioned has been more than a temporary clash, usually easily solved by attending to compiler warnings, and I’ve never had an actual bug as a result of it.

On top of that I personally would really like on principle to steer clear of new signs and symbols annotating variables. The lack (or restriction to its absolute minimum) of all that is one of the big benefits of Erlang, especially in combination with the immutability - like Craig says it just means you know what you’ve got and can trace it/“reason about it” more confidently, and in my experience at least the question of clashes/rebinding have been edge cases, easily trapped.

I don’t know enough about Elixir to have an opinion on its use there, but to me personally, it just doesn’t seem necessary in Erlang, and for my purposes would serve mostly to add visual noise and complexity that don’t seem at home there.

Of course, it’s just my holiday-time 2 cents, and I realise I’d be free not to use it if I chose not to - as someone who mostly writes erlang alone this would often be fine, but it would gradually start to crop up in libraries and deps.

Happy holidays to all,
Igor


> On 25 Dec 2020, at 09:46, Eric Pailleau <eric.pailleau@REDACTED> wrote:
> 
> 
> ��
> 
> Envoyé depuis mon mobile
> 
> 
> ---- zxq9 a écrit ----
> 
> 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...
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20201225/21b0e426/attachment.htm>


More information about the erlang-questions mailing list