[erlang-questions] (Non)Parametrized modules, inheritance, and R15B02 issues?

Tomas Morstein <>
Fri Oct 12 10:42:51 CEST 2012

> -module(person).
> -record(person, {first_name, last_name}).
> -compile(export_all).
> new(FirstName, LastName) ->
>   #person{first_name = FirstName, last_name = LastName}.
> first_name(Person) ->
>   Perosn#person.first_name.

Ha, that's what I didn't know about!
With this feature, I can start to sleep without nightmares again :-)

> So from point of view of readability there will be no change,
> althought the amount of code in the model module (person.erl) will
> slightly increase.

What's not so big deal since both boss_db and iodb models
are preprocessed (partially generated) by model-compiler.
So only what we will have to do is to change model compiler.

What's more, I believe boss_db could remain backward compatible
because it shouldn't be so problematic to transform
  -model (person, [FirstName, LastName])
  -model (person).
  -record (person, {first_name, last_name}).
during the preprocessing, before passing to the Erlang compiler

With our IODB model compiler, we already do something similar
but in another direction -- we define IODB data fields through
attributes that are in turn used to generate access functions.

Each module that is not wrote as parametrized is automatically
converted to pmod by preprocessor.
It is also automatically extended by another module with
abstract model logic, what's the real problem why I have
started this thread ;-)

More information about the erlang-questions mailing list