[erlang-questions] Re: Will parameterized modules become an official part of Erlang?

Ulf Wiger <>
Tue Feb 23 12:09:24 CET 2010


John Hughes wrote:
> We use parameterised modules occasionally in the internals of 
> QuickCheck. The reason is that we need to supply a call-back module 
> implementing a behaviour to a generic module like gen_server or gen_fsm, 
> and the callback module needs access to parameters that aren't fixed. So 
> we use a parameterised call-back module and pass that to the generic 
> one. This is the same kind of example that motivated Richard Carlsson's 
> paper in the first place... and there isn't any other good way of 
> solving the problem. Making the parameterised module into a gen_server 
> instead, which has been suggested, isn't a good solution in this case 
> because it's not reentrant--you can then only have one "instance" of the 
> parameterised module at a time. What if you need more?

For basically the same reason I used parameterized modules extensively
in Erlhive. Now, Erlhive doesn't have a huge community (by any 
definition of huge), but parameterized modules fit the problem very
well. The problem there was that I needed to momentarily "fix" some
parts of the environment so that they couldn't be changed or subverted,
while still beingaccessible in a way that was very fast, and also
reentrant.

BR,
Ulf W
-- 
Ulf Wiger
CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd
http://www.erlang-solutions.com
---------------------------------------------------

---------------------------------------------------

WE'VE CHANGED NAMES!

Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.

www.erlang-solutions.com



More information about the erlang-questions mailing list