views:

144

answers:

1

The implementation of ScrumJet on GitHub (as of this writing) shares essentially identical functions between the storage modules for tasks, categories and boards. This was achieved by moving the identical code which makes heavy use of the ?MODULE macro into scrumjet_datastore.hrl. Each of scrumjet_task.erl, scrumjet_category.erl and scrumjet_board.erl include scrumjet_datastore.hrl and have no functions defined locally.

This works very well when there is nothing wrong. However, if I need to debug, then the debugger brings up the empty module instead of the header file where the functions are defined. Does anyone know how to make the Erlang debugger work for functions in includes?

A: 

Using includes in Erlang to share implementations of functions is not generally a good idea. It has some uses, but it should be avoided in regular application code.

As I mentioned back in 2009 I followed Zed and Adam Lindberg's advice and used a datastore module with parameterized methods instead.

Alain O'Dea