Is it detrimental for the BEAM to create many modules

For an app, I would like to implement a command pattern, a la Commanded.
I would like to know if there could be downsides to creating a different module (with a defstruct inside) for each command. Say 200.

Theoretically, yes. In practice, no.

Just remember that module names are atoms, and so it is technically possible to fill the atom table with module names alone, but as long as you are not dynamically creating modules (from user input or some other external way), you should be fine.

2 Likes

As long as the complexity does not explode due to automatic creation of a lot of modules, you’ll be quite fine even with like 10,000.

1 Like

Well no, I do not intend to dynamically create modules :slight_smile:

So, thank you both.