This has been discussed many times in the past. You can find discussions on
the mailing lists and other places by searching.

Here is one of the explanations:
http://stackoverflow.com/questions/18011784/why-are-there-two-kinds-of-functions-in-elixir

Here is a discussion about changing the behaviour (although old) which
might give some additional insight:
https://groups.google.com/forum/#!msg/elixir-lang-core/_kEBXO0NRDY/fmdkDvCHLsEJ

On Thu, Jul 7, 2016 at 12:54 AM, Matt R <[email protected]> wrote:

> Given this code:
>
> defmodule Foo do
>   def bar(i), do: i * 2
> end
>
> anon = fn (i) -> i * 2 end
>
> import Foo
>
> Foo.bar(3) # 6
> Foo.bar 3 # 6
> bar(3) # 6
> bar 3 # 6
> (&bar/1).(3) # 6
> anon.(3) # 6
>
> 3 |> Foo.bar() # 6
> 3 |> Foo.bar # 6
> 3 |> bar() # 6
> 3 |> bar # 6
> 3 |> (&bar/1).() # 6
> 3 |> anon.() # 6
>
> Both are functions, one anonymous one defined in a module. Yet calling
> them is very different, starting with the dot before the parenthesis for
> the anonymous function. Also, you can't call it without parenthesis, unlike
> named functions
>
> Is there a reason for this distinction?
>
> If not, I propose to remove that distinction and have the call be the
> same.
>
> --
> 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/d24b8458-1510-4bbb-a284-868e91a3b758%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/d24b8458-1510-4bbb-a284-868e91a3b758%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Eric Meadows-Jönsson

-- 
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/CAM_eaph%3Duxw%3DjC0sSu%3Dg_Mjftn2PvUzet4Pz9iWmr5-cnSOyDw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to