Definitely like `fun/1,2` better

On Mon, Oct 1, 2018 at 1:20 PM José Valim <[email protected]>
wrote:

> Another advantage of comma is that there is less ambiguity, as `foo/2/4`
> may actually be an expression.
>
>
>
> *José Valim*
> www.plataformatec.com.br
> Skype: jv.ptec
> Founder and Director of R&D
>
> On Mon, Oct 1, 2018 at 10:18 PM, OvermindDL1 <[email protected]>
> wrote:
>
>> I'm a fan of `fun/1,2` or so, but not `fun/1/2` as that starts to look
>> like a path and not a function link.
>>
>> On Monday, October 1, 2018 at 2:01:14 PM UTC-6, José Valim wrote:
>>>
>>> I don't think we should support `fun/*` because it implies any amount of
>>> arguments and I don't believe there is a single construct in Elixir that
>>> would allow that. While I would personally prefer `foo/1/2` (it feels like
>>> it conveys multiple arities better, but that's personal opinion), I will be
>>> happy to settle on `fun/1,2` too.
>>>
>>>
>>>
>>> *José Valim*
>>> www.plataformatec.com.br
>>> Skype: jv.ptec
>>> Founder and Director of R&D
>>>
>>> On Mon, Oct 1, 2018 at 9:48 PM, Fernando Tapia Rico <[email protected]>
>>> wrote:
>>>
>>>> Unfortunately, there isn’t a standard way to refer to functions with
>>>> multiple arities in the documentation. That leads to inconsistencies: some
>>>> places use an asterisk `fun/*`
>>>> <https://github.com/elixir-lang/elixir/blob/master/lib/mix/lib/mix/config.ex#L15>;
>>>> others a list of arities separated by comma `fun/1,2`
>>>> <https://github.com/elixir-lang/elixir/blob/master/lib/elixir/test/elixir/string_test.exs#L29>;
>>>> others a list of arities separated by slashes `fun/1/2
>>>> <https://github.com/elixir-lang/elixir/blob/master/lib/elixir/pages/Compatibility%20and%20Deprecations.md#table-of-deprecations>`;
>>>> and others just the name of the function `fun`
>>>> <https://github.com/elixir-lang/elixir/blob/master/lib/ex_unit/lib/ex_unit/case.ex#L24-L25>
>>>> .
>>>>
>>>> Moreover, ExDoc’s auto-linking does not work with any of those
>>>> expressions
>>>> <https://hexdocs.pm/ex_unit/ExUnit.Callbacks.html#on_exit/2>, loosing
>>>> one of the features that I personally find really useful. In fact, that's
>>>> how I was planning to encourage the usage of the agreed syntax.
>>>>
>>>> After inspecting the Elixir codebase, I’ve found that `fun/1,2` is the
>>>> most popular expression, and that seems the format used in the Erlang
>>>> documentation <http://erlang.org/doc/man/io_lib.html#fwrite-2>. I'll
>>>> go with that.
>>>>
>>>> Regarding ExDoc, I would use the first arity to create the link (Erlang
>>>> documentation seems to do the same). For example `Module.fun/1,2` would
>>>> link to `Module.html#fun/1`; and `Module.fun/4,3` to `Module.html#fun/4`. I
>>>> like this option because it allows developers to control were the link is
>>>> going to point to. I’ve discarded the option of creating multiple anchors
>>>> like `#fun/1,2` to avoid the combinatorial explosion of cases like
>>>> `#fun/1,2,3,4`.
>>>>
>>>> As a final note, I'm not sure what to do regarding `fun/*` syntax.
>>>> ExDoc could link to the function with lowest arity, but I would like to
>>>> hear some opinions regarding that.
>>>>
>>>> Thoughts?
>>>>
>>>> --
>>>> 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/e29c4e5d-0696-4645-821e-b2cca45fc722%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/elixir-lang-core/e29c4e5d-0696-4645-821e-b2cca45fc722%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/2bd2fd3a-1ce9-40a0-965d-d5d1f9ee990e%40googlegroups.com
>> <https://groups.google.com/d/msgid/elixir-lang-core/2bd2fd3a-1ce9-40a0-965d-d5d1f9ee990e%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/CAGnRm4KOwhm4FyvAZdxdrLu-j6wTS_qB-puGOF0%3DHYhS3q3Ukw%40mail.gmail.com
> <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4KOwhm4FyvAZdxdrLu-j6wTS_qB-puGOF0%3DHYhS3q3Ukw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Steve Morin | Hacker, Entrepreneur, Startup Advisor
twitter.com/SteveMorin | stevemorin.com
*Live the dream start a startup. Make the world ... a better place.*

-- 
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/CAPxhEGeWjXTBFcw2mHMrzCoYUXGEYds0q_%2B03_BdfmbSRMum%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to