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.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s