Monthly Archives: December 2008

Erlang Parametrized Modules

This is absolutely great but undocumented feature of Erlang language.

In brief:
Basically it is like a class instantiation in OOP. It looks like ModuleInstance=my_module:new(InstanceParams). And then you can call module instance’s methods like ModuleInstance:do_smth() . If module is parametrized -module(my_module, [ModuleParam]). you can not call its’ methods until you create an instance. The difference from OOP class instances though is that calling new with same parameters will return the same instance.