Generally speaking, I agree with Chulki Lee. I understand the value of the identity function. But the cons of adding it to Kernel is that we partially take the name away from everyone else, unless they unimport it, and ultimately the implementation of identity/1 is not doing much to wararnt this loss.
*José Valim* www.plataformatec.com.br Skype: jv.ptec Founder and Director of R&D On Fri, Jul 12, 2019 at 6:59 PM Chulki Lee <[email protected]> wrote: > I'm happy to see Elixir adopting FP concept here ([identity function]( > https://en.wikipedia.org/wiki/Identity_function)), but I'm not sure it's > good to add it to `Kernel` (as it's imported by default!) - or even in > Elixir core. > > Why should we add this to Elixir core, instead of "extending" with module? > > ```elixir > defmodule FP do > def identity(a), do: a > end > > def module YourApp do > import FP > > def hello do > 'abcdaabccc' |> Enum.sort |> Enum.chunk_by(&identity/1) > end > end > ``` > > For example, that library can be de-facto helper for such FP utility > functions. > > -- > 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/2e98526b-e83c-4b92-8035-26bce95da822%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/2e98526b-e83c-4b92-8035-26bce95da822%40googlegroups.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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4LwDrMSMDnX9PNM5LeJr_7r7qBYTZuBMUtiEGrDB8VLkw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
