Good find, yes indeed (at least as far as i can see)! Now i can at least get rid of manually importing the helper everywhere.. :)
halos...@gmail.com schrieb am Mittwoch, 21. September 2022 um 18:33:27 UTC+2: > I like this idea. In your implementation, wouldn’t `inspect/1` do the same > as your `literally/1`, more or less? > > ```elixir > iex(3)> inspect(&String.capitalize/1) > "&String.capitalize/1" > ``` > > -a > > On Wed, Sep 21, 2022 at 12:21 PM Florian Neumann <florian...@gmail.com> > wrote: > >> The example for ExUnit's "Case.describe/2" >> <https://hexdocs.pm/ex_unit/ExUnit.Case.html#describe/2-examples> uses a >> String to reference to the given Function in test: >> >> describe "String.capitalize/1" do... >> >> Changes to the actual implementation (names, arity) are currently not >> picked up by the compiler or test frameworks. >> >> To help myself out i wrote a helper function "literally/1" which accepts >> a function as parameter and turns it into a fully qualified function >> capture string: >> >> describe literally(&String.capitalize/1) do... >> >> This removes potential code smells when referring to functions. >> >> Having a dedicated function for this adds a lot of clutter (every >> describe line get's expanded and you have to maintain that helper function >> in each project). >> >> So if this is something improving the developer experience for anybody >> else i'd like to propose the additional acceptance of function-captures as >> first parameter of describe/2: >> >> describe &String.capitalize/1 do... >> >> P.s.: i hope i got the terms function capture for function references >> right. >> >> -- >> 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/3b47d4bf-4e91-4896-8549-a9ffab5890a0n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/elixir-lang-core/3b47d4bf-4e91-4896-8549-a9ffab5890a0n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > > > -- > Austin Ziegler • halos...@gmail.com • aus...@halostatue.ca > http://www.halostatue.ca/ • http://twitter.com/halostatue > -- 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/225c6595-d51d-4a08-b350-9cc04e9ecbfcn%40googlegroups.com.