[erlang-questions] Parameterized module initialization

Robert Virding <>
Thu Jun 28 01:24:18 CEST 2012


I quite agree. Having finally got rid of {M,F} please,please,please don't replace it with something even worse. I am no great fan of parametrised modules but if they are to be properly added to the language then do it as an opaque data type and use the module:new function to initialise it.

Otherwise we might as well open up funs as well so we can really have fun.*

Robert

* that was being sarcastic. 

----- Original Message -----
> Hi,
> 
> On Tue, Jun 26, 2012 at 2:53 PM, Joe Armstrong <>
> wrote:
> > There is an undocumented way of doing this (which one day will
> > become standard)
> > Suppose we define X as follows:
> >> X = {mod1, a,b,c}.
> > {mod1, a,b,c}.
> > X is now an instance of a parameterised module. if we now call the
> > function X:func1(x,y) then what actually gets called is the
> > function
> > mod1:func1(x,y,{mod1,a,b,c})
> 
> I hope that you are expressing some form of sarcasm, Joe.
> 
> If I may use such language, it is horrible. Just as we got (almost)
> rid of {M,F} to the benefit of proper function references, are we
> going to get another kludge? A proper module reference is the way to
> go here. Then there are plenty of nice things that can be supported
> in
> a clean way.
> 
> best regards,
> Vlad
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
> 



More information about the erlang-questions mailing list