New EEP draft: Pinning operator ^ in patterns
Thu Jan 21 18:21:16 CET 2021
On 2021-01-21 15:41, Richard Carlsson wrote:
> On the whole, I find the annotated code so much more readable (in those
> places where already-bound variables are used), that it's not even funny
> when I think about all the time lost over the years to staring at the code
> and trying to see which variables are already bound and how that affects
> the control flow. With ^-annotations, these uses stick out very clearly
> even when quickly scanning the code in less or git diff.
While I agree that some of the examples you give are indeed confusing, why
would a warning flag not be good enough ? It would have multiple advantages:
- Anyone would be able to either warn or totally reject (with
warnings_as_errors) these kinds of construction.
- Anyone who does not care would be able to totally ignore it (and please do
not tell me that this new operator/annotation would be optional, there is no
way it would not be become mandatory at some point).
- This would have no effect on existing codebases, therefore removing any
migration cost. I cannot even begin to explain how bad of an idea it would
be to force every Erlang developer all other the world to patch all their
projects because something that worked perfectly before now requires a
- This would not affect the language itself in any way, sidestepping any
discussion about the syntax itself.
Now you could argue that you wish to be able to use these kinds of
constructions on occasion, but then surely you would agree that checking
equality in a guard is far more explicit and therefore more readable.
More information about the erlang-questions