Getting the whole agent state is often a bad idea, so we want to force you to think if you really need the whole state or part of it. Depending on the data, you can have a drastic difference between:
Agent.get(pid).some_field and: Agent.get(pid, & &1.some_field) So in the cases you do want it all, being explicit about it doesn't hurt. On Tue, May 19, 2020 at 3:10 PM Pierre Le Gall <pierre.leg...@zenika.com> wrote: > Hello, > > Writing `Agent.get(agent, fn x -> x end)` or even shorter > `Agent.get(agent, &(&1))` is kind of verbose for this non-specific > behavior. > > Maybe the `fun` argument of `Agent.get/2` could be set to `fn x -> x > end` by default making `Agent.get/1` available? > > -- > Pierre > > -- > 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/CAL3hriJqr95fxzLaDXadYsUNWR1-Njzcgtpr-NJp8kS%3Ddin0Jw%40mail.gmail.com > . > -- 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/CAGnRm4KXHaye%2BdsAq4x%3DwDx7L9mTK9P4%2Bv0PZZ4vDLjV0Pc-qg%40mail.gmail.com.