Will parameterized modules become an official part of Erlang?
Tue Feb 23 17:13:28 CET 2010
> Now the idea of replacing a parameterised module by a gen_server is based on
> saving the ModuleParams as the state of the server, so that they don't need
> to be supplied on each call.
I didn't quite understand the mechanics of this idea from your
previous message, but the clarification helps, thank you.
> I think you're imagining changing the calls in the generic code--passing a
> Pid as an extra argument, for example. Of course, if you do that, then you
> can use multiple processes to represent multiple instances. But now you're
> not reusing the generic code any more.
Correct, I was considering the hypothetical, albeit not too practical
"let's re-implement gen_server et al" approach :)
> With parameterised modules, we don't
> NEED to change the generic code at all, which is a big advantage.
Except that you had to change the language instead, which has
disadvantages. So there's a trade off: would you rather change the
language or re-implement the interfaces of the generic code? Both
approaches would seem to solve the problem at hand.
More information about the erlang-questions