[erlang-questions] Parameterized module idioms

Fred Hebert <>
Sat Apr 17 02:13:39 CEST 2010

On Fri, Apr 16, 2010 at 8:06 PM, Bob Ippolito <> wrote:

> Technically speaking the difference is:
> E:echo("hello") vs. some_module:echo(E, "hello")
> The biggest reason I've seen to use parameterized modules is that you
> could have a different module that implements the same interface, e.g.
> sets and gb_sets and you could change which one you're using without
> changing any of the code that consumes it.
> I would definitely change the original code to use two modules, one
> module to do the start_link stuff, and another module to actually
> implement the interface.
> -bob
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
> M = sets,
D = M:new().
M:add_element(10, D).

This works as well without a problem. Switch the value of M and if the
interface is the same, nothing changes.

More information about the erlang-questions mailing list