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
> On Jul 12, 2019, at 13:43, José Valim 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(_nil/1).
Cool! I just replaced four instances of
Filtering nils may be considered bad practice (i.e. why do you have nils
there?) so I think it should be done explicitly. And it may be more
readable to do with Enum.reject(_nil/1).
Enum.group_by with identity by default has no purpose. You are only going
to group the elements themselves. At best
:) all good.
I do think that both & &1 and fn x -> x end and & &1 are both harder to
scan than /1 as it's almost always better to name a concept for a
beginner (or most anyone, for that matter). In my classes we often write an
identity function as an intermediate teaching step because I can
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
If the goal is teaching, then I think "fn x -> x end" beats both
"/1" and "& &1" in terms of clarity, as identity itself is still a
concept that needs to be explained.
*José Valim*
www.plataformatec.com.br
Skype: jv.ptec
Founder and Director of R
On Fri, Jul 12, 2019 at 7:18 PM Bruce Tate
> Why should we add this to Elixir core, instead of "extending" with module?
I have been a big proponent of this for a long time because just about
every code base uses the identity function and it's a barrier to those who
would learn Elixir.
Rather than import or call /1, most would just
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
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
Any news here? @José Valim, let's do this. Almost everyone reacted to this
with enthusiasm. It would be nice. Without this function elixir couldn't be
a category :) Let's make elixir Lisp again!
вторник, 2 июля 2019 г., 21:40:45 UTC+3 пользователь José Valim написал:
>
> Thanks Chris, it is
10 matches
Mail list logo