Too much rage, to little understanding of what’s written. About zero knowledge about Erlang syntax.
Come on, there’s a disclaimer at the very top: it’s an opinionated opinion.
1: Please explain to me how exactly arrows are tied into the overall Elixir syntax. There’s, like, and entire paragraph asking this question in my text above.
2: Function invokation syntax:
What are you even talking about? All of those are exactly the same in Erlang.
And here’s where you let your rage blind you and prevent you from understanding what I’ve written. And you’re also totally wrong.
Here’s Erlang:
%% let's call a 'remote' function
%% (as it's called in Elixir)
lists:flatten(List)
%% let's assign this function to a variable
F = fun lists:flatten/1,
F(List) %% note how we use the var in exactly
%% the same way as a function
%% let's bind a var to create an anonymous function
F = fun(L) -> lists:flatten(L) end,
F(List) %% note how we use the var in exactly
%% the same way as a function
%% pass functions to other functions
lists:map(fun lists:flatten/1, List)
%% or
lists:map(F, List) %% doesn't matter if F is a "capture"
%% or an anonymous function
The behaviour above is the same for the overwhelming majority of functional languages: there’s virtually no difference betwen a function, a variable holding a function, or an anonymous function.
Let’s see how this is not true for Elixir:
## let's call a 'remote' function
List.flatten list
List.flatten(list)
## let's assign this function to a variable
f = &List.flatten/1
f.(list) ## Why the hell we need the dot now?
## Why can't I use this without parentheses?
## let's bind a var to create an anonymous function
f = fun l -> List.flatten l end,
f.(list) ## Why the hell do we need the dot now?
## Why can't I use this without parentheses?
## pass functions to other functions
Enum.map(list, &List.flatten/1)
Enum.map(list, &(&1*2)))
## or
Enum.map(list, f) ## hmmm. It's ok to just pass a var
## and then
list |> List.flatten
## but
list |> f.() ## Why the hell we need the dot now?
## Why can't I use this without parentheses?
som_var |> (&(&1*2)).() ## Same WTF
It is very likely “.()” won’t be used in the project itself.
Yeah, right. When Phoenix started, it was “very likely “.()” won’t be used in the project itself”. When Ecto started, it was “very likely “.()” won’t be used in the project itself”. When gettext… When HTTPoison… When Plug… When Postgrex…
For some reason all these projects have uses for the “function-bound-to-a-variable” call. It may be rare, but it’s there. Oh, I know. Because you cannot really write code with DI without them.
Articles like this only hurt the adoption of the platform. I am tired of hearing the same things over and over again for the past 10 years.
Articles like this point out WTFs in the platform. They show things that can be either improved or more properly documented.
Oh. And congrats on hearing the same thing about Elixir for 10 years when Elixir is only entering it’s fourth year ;) (← see the smiley? It means I understand what you are saying, I was just picking on the way the sentence sounded in context)
I wish Erlang developers were obsessed with Elixir’s documentation, tooling and standard library
Hey, you know what, it’s my wish too! Oh you know what else? People who say “I wish community X was doing Y instead of saying something about community/language Z” are the ones who split communities apart.