I’m working on a basic credit card validator as a practice project for learning Elixir. After finishing a large chunk of my
Validator module, I thought that I should go back through and make sure I guard clause some of the private functions I had written to ensure that they get used properly, which I had been doing for other private functions previously.
Thinking about it more now, however, I’m not sure whether this is actually necessary with private functions. If they can’t be called outside of the module, then I’m the one that’s controlling their use inside of the module — I know that they’re always being sent the right data in the right format.
I’m not sure which method is considered idiomatic Elixir. Should I add guard clauses to private functions anyways? Or are they unnecessary?