[erlang-questions] about the use of parametrized modules
Fri Jan 14 11:10:05 CET 2011
I'm forwarding this interesting answer to the list, it went out of
band because I hit reply instead of reply all.
---------- Forwarded message ----------
From: Jachym Holecek <>
Date: Fri, Jan 14, 2011 at 1:22 AM
Subject: Re: [erlang-questions] about the use of parametrized modules
To: Paolo Negri <>
# Paolo Negri 2011-01-14:
> On Fri, Jan 14, 2011 at 12:26 AM, Jachym Holecek <> wrote:
> > # Paolo Negri 2011-01-13:
> >> Looking at the misultin source code  I noticed the use of a
> >> parametrized module, after googling about it I came to the conclusion
> >> that there's something controversial about them  and that it seems
> >> to be appealing mainly people coming from OO background .
> >> I'm considering applying this technique [...]
> > Out of curiosity, what are your expactations from this move? IMVHO it only
> > obfuscates flow of control without any real benefit.
> > Regards,
> > -- Jachym
> I have a couple of modules where i pass along over and over the same
> variable to be able to extract information from it.
> Really looking at the misultin_req module produces a valid example of
> my case .
> But the whole point of asking here is to be aware of valid reasons not
> to do so and to know which one would be instead a good approach.
>  https://github.com/ostinelli/misultin/blob/master/src/misultin_req.erl
Understood. I think what misultin_req is doing is exactly The Right Thing (TM)
to do -- it makes data flow crystal clear even without previous exposure to the
codebase in question. If you were to pass more pieces of data this way, you
could pack them into a record/proplist/whatever, but personally I only do that
when there's embarassingly huge amount of data items (more than 10) and when
these are intimately inter-related. To put it briefly, code clarity outweights
the one-time effort of writing program text by several orders of magnitude. ;-)
I think Robert Virding kind of answers the "officialy approved" status of this
PS: Feel free to forward this back to the list if you find it useful.
More information about the erlang-questions