--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/e29c4e5d-0696-4645-821e-b2cca45fc722%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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.
On Mon, Oct 1, 2018 at 9:48 PM, Fernando Tapia Rico <fert...@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/*`; others a list of arities separated by comma `fun/1,2`; others a list of arities separated by slashes `fun/1/2`; and others just the name of the function `fun`.Moreover, ExDoc’s auto-linking does not work with any of those expressions, 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. 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-co...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/2bd2fd3a-1ce9-40a0-965d-d5d1f9ee990e%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/2bd2fd3a-1ce9-40a0-965d-d5d1f9ee990e%40googlegroups.com.
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 elixir-lang-co...@googlegroups.com.
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.
For more options, visit https://groups.google.com/d/optout.
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`.
Would we use this for functions with default arguments too or only for custom multiple-arity functions which relate to each other?
Would we use this for functions with default arguments too or only for custom multiple-arity functions which relate to each other?Just for the latter, but good catch!To give more examples, I wouldn't use the new syntax with `Map.get/3`, but I'll definitely use it for `Task.async/1,3` (when needed).
Foo.bar/{1, 2}Foo.bar/{1..3}--
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-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/20181020091333.0d4da8bd.eksperimental%40autistici.org.
--
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-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/20190813110430.52fabd61.eksperimental%40autistici.org.
I would be ok with `fun/1,2` but I prefer Christopher's solution using `fun/{1,2}` since that notation is already used in the core on various occasions.
On Tue, 13 Aug 2019 at 06:04, eksperimental <eksper...@autistici.org> wrote:
Thanks Fernando for bringing this back to life.
I'm OK. Let's have an agreement so we can start supporting it in ExDoc and make the according
changes to core.
On Sat, 10 Aug 2019 14:10:18 +0200
Wojtek Mach <woj...@wojtekmach.pl> wrote:
> > Is anyone ok with `fun/1,2`? `fun/*` won't be supported.
>
> I think this is already a pretty common way so definitely +1 from me on making it official.
>
--
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+unsubscribe@googlegroups.com.