Parameterized module idioms

Tim Fletcher <>
Sat Apr 17 11:39:04 CEST 2010


> The biggest 'advantage' of parametrized modules that I see is that you shift
> the burden of carrying state from a variable to a module name.

IMO this is also a disadvantage, but not specific to parametrized
modules: using variables for module references makes static analysis
harder (both in your head and in code).

For example, [unless you're doing some crazy rewriting tricks] it's
obvious which function this is calling:

    some_module:echo(E, "hello")

This isn't so obvious:

    E:echo("hello")

Here you have to trace back to the definition of E to find out what
module it refers to.

Tim


More information about the erlang-questions mailing list