I would love to see a PR that tries approach 1. And we can expand from that. :) Thank you.
On Wed, Apr 19, 2023 at 2:40 PM Bruce Tate <br...@grox.io> wrote: > I have been going over my notes and noting the places my students have > trouble with standard Elixir documentation. One of them is this example > code that starts a child for a dynamic supervisor: > > {:ok, agent1} = DynamicSupervisor.start_child(MyApp.DynamicSupervisor, { > Agent, fn -> %{} end}) Agent.update(agent1, &Map.put(&1, :key, "value")) > Agent.get(agent1, & &1) #=> %{key: "value"} {:ok, agent2} = > DynamicSupervisor.start_child(MyApp.DynamicSupervisor, {Agent, fn -> %{} > end}) Agent.get(agent2, & &1) #=> %{} DynamicSupervisor.count_children( > MyApp.DynamicSupervisor) #=> %{active: 2, specs: 2, supervisors: 0, > workers: 2} > > > This code gives students two problems: > > 1. It expresses a concept using an arguably more complex concept, and not > a common one: agents. > > 2. The child spec is not like typical gen servers because the initial > value is a function. > > I propose that we start a stack rather than an agent. Failing that, I > propose we label the concepts in the start spec with intermediate > variables. > > -bt > -- > > Regards, > Bruce Tate > CEO > > > <https://bowtie.mailbutler.io/tracking/hit/f8218219-d2a8-4de4-9fef-1cdde6e723f6/c7c97460-016e-45fb-a4ab-0a70318c7b97> > > Groxio, LLC. > 512.799.9366 > br...@grox.io > grox.io > > -- > 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/CAFXvW-45ExCPTm%3Ds-YCu1FoVpxeLWuLTt%2BDs6wV7-BzLPLDkGw%40mail.gmail.com > <https://groups.google.com/d/msgid/elixir-lang-core/CAFXvW-45ExCPTm%3Ds-YCu1FoVpxeLWuLTt%2BDs6wV7-BzLPLDkGw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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/CAGnRm4LNH6a-_8B0cj3tA%2BHBf71-N3zDAkxvmq4dqCzm3MNYLw%40mail.gmail.com.