[erlang-questions] New module syntax and semantics?

Richard Carlsson <>
Wed Jul 2 15:40:02 CEST 2008


Gleb Peregud wrote:
> On Wed, Jul 2, 2008 at 3:11 AM, Richard A. O'Keefe <> wrote:
>> It's certainly not clear that so heavy a sledgehammer is
>> needed for this nut.  Can you provide an example of the
>> 'unnecessarily cumbersome code' so we can see if it can
>> be clarified another way?
> 
> Is it so heavyweight? Aren't parametrized modules instances just a
> tuples of type {Mod, Param1, Param2, ...}? Or is calling of functions
> from such module too expensive?

The representation currently uses tuples, but should be regarded as
unknown. If this is made a documented feature, a new opaque 'module'
datatype will be added. (This is analogous to how funs were added,
several years ago.)

The heaviness of the solution in this case is not the calls via
a module instance (which are pretty efficient, much like funs),
but the need to write a separate module and instantiate it, just
to make it easier to work with nested records. You may still be right
that it actually makes a nicer solution, but we've seen to little
actual code examples to be able to tell if this is really the case
or if it could be done better even without abstract modules.

     /Richard C



More information about the erlang-questions mailing list