Have the formatter change it to an if/else 😈, or just leave it for tools like Credo to yell at you for an unless/else.
On Thu, Jan 3, 2019, 10:56 AM Parker Selbert <par...@sorentwo.com wrote: > If anything this seems more suited to be a warning rather than something > deprecated and slated for removal. It would be similar to how the compiler > suggests pattern matching on an empty list instead of length(list). The > difference being that there are performance differences for pattern > matching a list and using unless/else is purely confusing to humans. > > Regardless of how it would be done, I don’t think this change *should* be > done. > > On Jan 3, 2019, at 10:26, Chris Keathley <c...@keathley.io> wrote: > > Given that it's a breaking change this wouldn't happen till at least some > future version of Elixir so its not really a real discussion. That said, > generally speaking the amount of times you need to break an existing api > are close to 0 and definitely shouldn't be driven by what the community > believes is a good or bad pattern at the moment. If people want to lock > down subsets of the language then there are tools to do that. I'm not > really defending `unless` `else` or its usage. But for better or worse its > a part of the language and breaking the language should effectively never > be an option. > > On Thu, Jan 3, 2019 at 1:02 PM Josh Adams <josh.ruby...@gmail.com> wrote: > >> I really appreciate this suggestion. It would be a breaking change to the >> API, so that's a negative and implies that it couldn't actually happen >> until Elixir 2.0 I would assume. However, I can confirm that every single >> time I've seen an `unless/else` it has resulted in confusing logic and >> removing the option entirely will just make codebases clearer imho. >> >> Josh >> >> On Thu, Jan 3, 2019 at 11:26 AM Mikael Muszynski <lindu...@gmail.com> >> wrote: >> >>> I would like to propose the removal of the ability to use >>> `Kernel.unless/2` with an `else`-clause. >>> >>> This proposal is inspired by the seeming consensus between the most >>> prominent style guides for Elixir, along with similar consensus in the most >>> often cited style guides for Ruby (where this ability exists as well). >>> >>> Some examples for Elixir: >>> >>> - https://github.com/lexmag/elixir-style-guide#no-else-with-unless >>> - >>> https://github.com/christopheradams/elixir_style_guide#unless-with-else >>> - https://github.com/rrrene/elixir-style-guide#no-unless-with-else >>> >>> Similar examples for Ruby: >>> >>> - https://github.com/rubocop-hq/ruby-style-guide#no-else-with-unless >>> - https://github.com/airbnb/ruby#no-unless-with-else >>> - https://shopify.github.io/ruby-style-guide/ >>> >>> I have not researched the topic to the degree that I can point to some >>> scientific study regarding how comprehensible negated booleans are. >>> However, if the style guides are an indicator of community preferences, >>> then anywhere they are enforced, `unless-else` will likely be banned. >>> >>> I have nothing but intuition to go by when it comes to how many Elixir >>> users are actually using style guides like the ones above (with or without >>> automatic checking), but the people and companies I've worked with >>> generally use these guides. >>> >>> Therefore, this proposal is mostly a question whether this one rule >>> should be enforced everywhere, at the potential expense of those who don't >>> care much about style guides. I guess that also opens discussion about >>> whether other rules could receive similar treatment, but that's a >>> discussion for a different thread. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "elixir-lang-core" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to elixir-lang-core+unsubscr...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/elixir-lang-core/6fd77557-3080-496b-af5f-fe51cf9de79b%40googlegroups.com >>> <https://groups.google.com/d/msgid/elixir-lang-core/6fd77557-3080-496b-af5f-fe51cf9de79b%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> -- >> Josh Adams >> >> -- >> You received this message because you are subscribed to the Google Groups >> "elixir-lang-core" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to elixir-lang-core+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elixir-lang-core/CAA1-O0wBG_KDg140BCgBmRKN5ggpJoYjfsK%3D7Lt6qw97NBXtOg%40mail.gmail.com >> <https://groups.google.com/d/msgid/elixir-lang-core/CAA1-O0wBG_KDg140BCgBmRKN5ggpJoYjfsK%3D7Lt6qw97NBXtOg%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > > -- > Chris > > -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to elixir-lang-core+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/CAGjNwxosn5L_EMuuBrpnCYSV91U4_QGBDm2URC1%2BCLj1qzM9gA%40mail.gmail.com > <https://groups.google.com/d/msgid/elixir-lang-core/CAGjNwxosn5L_EMuuBrpnCYSV91U4_QGBDm2URC1%2BCLj1qzM9gA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to elixir-lang-core+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/855E9B37-B56F-4821-93EC-D320FB2EFC0A%40sorentwo.com > <https://groups.google.com/d/msgid/elixir-lang-core/855E9B37-B56F-4821-93EC-D320FB2EFC0A%40sorentwo.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAKBKqKQ3HSa-qO6yBFWxVkMjv%3DjkiY%2BW9mv_PrSj63jYqs8FYQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.