Thanks for bring this up, as I thought the same way. Also we need to add support for this in ExDoc.
I'm all for using ",". I have also found myself using Mod.fun/1-3 when refering to functions with default arguments. I find it cleaner than using commas when referring to the same function with default args On Mon, 1 Oct 2018 12:48:39 -0700 (PDT) Fernando Tapia Rico <fertap...@gmail.com> 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 elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/20181020091333.0d4da8bd.eksperimental%40autistici.org. For more options, visit https://groups.google.com/d/optout.