I would like to use a -record in every single erl files I have. I know I can repeat the record individually in every files, but that's really ugly.
Any suggestion ?
P.S. : Be gentle ;-) I'm an Erlang newbie.
Put your record definition in a header (.hrl) file. For example, animal.hrl
may look like:
-record(animal, {name, legs=4, eyes=2}).
Then in your .erl files you can include the .hrl file like so:
-include_lib("animal.hrl").
src
directory unless it's needed outside of your application - in that case you should put it in a directory called include
.