Thanks - I’m sorry but I think I am still kind of puzzled. Why is not “leaking it directly” a useful/good thing? Or put differently, if
Agent is just there to hold state and let us access it, what’s the benefit of requiring a function be invoked to do that instead of just handing it over?
When I look at the source, for example, all it does is send the function and arguments to
start_link/3 for the underlying GenServer, the
init/1 callback for which calls a function that just runs
apply/2. So it doesn’t seem like the function is being transformed, evaluated, checked or otherwise “used for anything” so to speak; it’s always just getting passed along until finally it gets applied to the arguments passed along with it, which I could just as easily do myself in the first place before passing in the result to be stored.
Thanks again - I’m not trying to punish anyone for trying to be helpful and I appreciate your explanation.