Generally I like maybe even love Erlang syntax, but some result of its flexibility and simplicity hit me hard today. I have a supervisor starting several gen_servers, this is part of the supervisor configuration in its init function:
#{
id => server_1,
start => {gen_server, start_link, [{local, server_1}, server_1, [], []]},
modules => [server_1]
},
#{
id => server_2,
start => {gen_server, start_link, [{local, server_2}, server_2, [], []]},
modules => [server_2]
}
#{
id => server_3,
start => {gen_server, start_link, [{local, server_3}, server_3, [], []]},
modules => [server_3]
}
The server_2 was not running, and after a long and painful hour finally I have noticed missing comma between server_2 and server_3. Due to the way Erlang syntax works this was interpreted as two maps, not an error. This typo is the reason why server_2 silently does not start!
Maybe we could have a warning when a literal map is overridden with another literal map?