-
Notifications
You must be signed in to change notification settings - Fork 36
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
Unless is complex to read #190
Comments
Cheers Jan, thanks for caring enough to open an issue =) Sorry you were shocked! It is in the release notes:
As to your question:
Who's to say! Just a style thing. Consistency, at least, is better than inconsistency, and Styler was already rewriting some simple negations to unless statements. Anyways, we take no offense to the folks who fork styler to make it do things more to their own personal tastes I'm open to changing features based on feedback - so please don't feel discouraged from opening more issues - but typically am only looking to add them, as opposed to remove them. The things Styler's doing, it's doing because we want it to. Like it says in the readme:
Have a good one =) |
Based on this PR is looks like Elixir is planning on soft deprecating |
ooo thanks @ypconstante! now there's a solid reason to nuke our unless rewrites :D |
if the core team goes ahead with that i'll definitely be updating styler to remove all |
released 1.1, which removes |
Versions
Elixir
Styler
Example Input
Current Behaviour
Problem
We're about to upgrade styler to 1.x and I was shocked after checking what have changed after running the formatter 😲
I know that Elixir has
if
and its negated versionunless
, but I really don't get whyunless env == :test
should be more readable thanif env != :test
🤔 Just because it is there doesn't mean we need to use it.When reading the code I first see
env == :test
and to know whether this is true or not I also need to look whether it is anif
orunless
clause. So, I always need to think about two things instead of just one when simply using aif
-clause.Maybe that's just because of how my brain works, especially because I never used
unless
before, but I would really like to know whether usingunless
is really better than having anif
-clause with a negation.The text was updated successfully, but these errors were encountered: