-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Binary Operators: Pipe: Change erlfmt formatting to place pipes at the beginning of lines #167
Comments
The main reason is very mundane: we place all operators at the end of the line. One of our design principles is avoiding special cases. |
Do you think it is worth reconsidering for this very popular case? |
Potentially yes. One way to settle this would be to analyse some existing codebases to see which style is more prevalent. |
I actually prefer operator, pipes, etc. "before" code (rationale: I don't need to read until the end of the line to understand something will change in the next line). I understand the need to have a solid opinion (as a default), but am all for having the choice to "tweak" the output to suite what I prefer. 😄 |
Ha ha totally agree @paulo-ferraz-oliveira :D I am also a prefix pipe person and even a prefix comma person, but I agree with @michalmuskala lets try to settle the issue using data. I think we should focus this analysis on pipes specifically. |
Haven't gotten used to this one yet, but @elbrujohalcon is surely trying to make me like it 😛 (i.e.
A bit of a side track here: why are configuration options frowned upon? We use them all the time, everywhere (optional callback, optional map fields, optional elements in proplists, ...). Is it because of maintenance costs? |
One of the main goals of this formatter is to remove style discussions from team dynamics. If you have options that can be tweaked this goal is not achieved - you'll now be discussing which options to use. |
Not trying to advocate for adding options to You can also avoid style discussions in team dynamics by going the other way as we did with |
While I agree this could be a valid approach, I personally think it creates more issues than it solves. There a lots of cases where you read code not locally (e.g. github or in PRs) and there are also cases where having consistent line numbers between developers is important (e.g. for easily sharing stack traces). |
I see. I guess it is a matter of what happens more often or what is a larger PITA... Having to work with code that you drastically dislike / can't read or understand... Or having to apply the canonical formatter before sharing the code you are working on with others.... |
Fair, but teams usually also have a "decision" committee, which decides which are the best options (and sticks to those). I understand your point, though. |
We hope we can find a compromise, which means everyone will just slightly dislike some formatting and not drastically dislike / can't read code and eliminate the read for a decision committee to discuss formatting when they can be focusing on more important things. |
My personal belief (emphasis on "belief" since I have 0 proof/data about it) is that it will be fine for new projects where, from the get-go, everybody will just use …and now… back to the show 🤪 |
Edit: changing Another good point about using You have [
a |
b
] now you add a [
a |
b | % changed here
c % changed here
] (two lines changed). On the other hand, you have: [
a
| b
] now you add a [
a
| b
| c % changed here
] (one line changed) [I'm sorry if this was already discussed before] |
@paulo-ferraz-oliveira is it possible to move you comments about Even if it is discussed before, it is still useful to see others agree with some point or run into the same issue. |
Another data point for |
I'll change from |
We now have a proposal to move pipes to be a prefix with some data to back it up |
Hurrah for data. ❤️ |
This was a question brought up multiple times in an experimental diff on OTP:
This is some we should reconsider and provide a formatting decision document on.
The text was updated successfully, but these errors were encountered: