I understand that the desire from the core team isn't to add this. I'm OK with that decision despite feeling like it would be a good addition That's fine.
But I do take issue with this "slippery slope" argument that adding `identity` to Elixir would somehow open the door to numerous other functions being added to Elixir. Which is silly. Because we aren't talking about adding some untold number of functions to Elixir. We're talking about `identity`. If the core team had decided that `identity` was worth having in the language would we still not add it because later someone could add the `snausages` function? No. Of course not. That's a nonsensical argument. Improvements to the language should be considered on their own terms. On Sat, Jul 13, 2019 at 12:26 AM Sven Gehring <[email protected]> wrote: > I definitely agree that it's better to import it from an additional module > if need be. > > If we ignore the Metaprogramming parts, Elixir has a very easy Syntax and > the &(&1) notation is one of the only non-intuitive things to learn. > Compared to other languages, there are virtually no 'weird' syntax elements > you have to 'just remember' when you start out, so I am actually in favor > of teaching people this shorthand instead of hiding it from them. (It's > really not THAT complicated) > > Also, as José said, you can always use "fn x -> x end", which is about the > same length as "&identity/1" and also obvious in what it does. > > I don't think expanding the Kernel just for the sake of adopting concepts > of similar ecosystems is worth it. > > Sven > > On Fri, Jul 12, 2019, 23:10 Rich Morin <[email protected]> wrote: > >> > On Jul 12, 2019, at 13:43, José Valim <[email protected]> >> wrote: >> > >> > Filtering nils may be considered bad practice (i.e. why do you have >> nils there?) >> >> I use them, on occasion, to support a "maybe" type. >> >> > ... it may be more readable to do with Enum.reject(&is_nil/1). >> >> Cool! I just replaced four instances of `Enum.filter(&(&1))` with >> `Enum.reject(&is_nil/1)`. >> FWIW, I'd love to see an annotated collection of suggested Elixir idioms >> such as this one. >> >> -r >> >> -- >> 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 [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elixir-lang-core/C4BDFC3F-1646-4957-B814-0204D3B147A6%40gmail.com >> . >> 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/CAFuVuxzkdQbPZaPHRWA6w13LE1jFZm-sgoxK8ToOkTag2_9AbA%40mail.gmail.com > <https://groups.google.com/d/msgid/elixir-lang-core/CAFuVuxzkdQbPZaPHRWA6w13LE1jFZm-sgoxK8ToOkTag2_9AbA%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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGjNwxr-28E8WpXxoJ%2B8erxGOx-q65XvXFDwgric-uGDrcaFRw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
