This is exact reason I'm against adding it to Kernel :) I already have a 
code using "identity". What would it happen when I upgrade to new Elixir 
version having this feature?)



Let's look at the list of functions/macros in Kernel  and its description - 
https://hexdocs.pm/elixir/Kernel.html
 

> It mainly consists of:
>    
>    - basic language primitives, such as arithmetic operators, spawning of 
>    processes, data type handling, etc. 
>
>
>    - macros for control-flow and defining new functionality (modules, 
>    functions, and so on) 
>
>
>    - guard checks for augmenting pattern matching
>
>
I don't think this new addition (identity/1) does not fit well with Kernel.

Don't get me wrong - I *like* adopting such concepts in Elixir. There are 
already some functions using such common or mathematical terms (such as 
List.foldl/3)

However, adding it to Kernel should be more conservative. We cannot more 
and more such functions into Kernel only because 1) it's convenient and 2) 
there is not other places to hold it in Elixir core.


 


On Friday, July 12, 2019 at 10:15:20 AM UTC-7, José Valim wrote:
>
> 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 <chul...@gmail.com 
> <javascript:>> 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 elixir-l...@googlegroups.com <javascript:>.
>> 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 elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/478e7024-13e6-419e-a187-79eb3ddb34cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to