Coming from a static language background it’s really hard to get around the “elixir-way”.
@OvermindDL1 What would be your approach if instead of integers you’d need a list of atoms?
Imagine if you needed to validate a list of valid countries; it seems a bit overkill (due to repetition) to just:
def countries, do: %{
united_states: :united_states,
canada: :canada,
paris: :paris,
england: :england
}
# maybe just... (???)
# def valid_countries, do: [:united_states, :canada, :paris, :england]
Instead of simply scattering atoms in the application, I like the idea to have a “single source of truth” to serve like self-documentation (mainly autocomplete). In that case, I’d typically use an enum or a class with static const properties in C#.
PS.: BTW I don’t like very much the idea of using loose JSON files in the project like @benperiton.


















