[erlang-questions] Why are records not 'export'-able?

Attila Rajmund Nohl <>
Fri Jun 29 17:27:21 CEST 2012


2012/6/29 Mahesh Paolini-Subramanya <>:
> If I have a record I use in just one module, I declare it in that module.
> If I have a record I use across a number of modules, I declare it in an
> included file.
> If I have a record that I use across a number of applications, I end up
> declaring it once in each application.
>
> The simple-minded me says "Hmf. If I could just have a '-export_record'
> declaration, then I could do some fun things like '-record(Name,
> Application:Record)'
>
> The more realistic me says "There is probably some reason why you can't do
> this. Probably has to do with compilers. It usually does".

As the documentation says, "record is not a true data type. Instead
record expressions are translated to tuple expressions during
compilation.", so there's nothing to export. However, nothing stops
you from including a header from an other application.



More information about the erlang-questions mailing list