[erlang-questions] about the use of parametrized modules

Alisdair Sullivan alisdairsullivan@REDACTED
Fri Jan 14 21:56:44 CET 2011



>> What prevent you add SockedPid to Req
>> It already contain socket and socket_mode, why not SockedPid?
> 
> the fact that SocketPid shouldn't be used by developers, the rest, yes.

There is essentially no functional difference between 'Req:foo(bar, baz)' and 'req:foo(Req, bar, baz)'. In both examples Req is an opaque blob that we are calling a function on. The second, however, makes it much clearer at a cost of a few keystrokes. if you wish to hide state from users the correct abstraction is an opaque type or process - both of which have clearly defined interfaces - not a module.

The popularity of parameterized modules is that they look familiar to people coming from python and ruby and java. That is not sufficient reason to use them.
> 


More information about the erlang-questions mailing list