Embed Notice
HTML Code
Corresponding Notice
- Embed this notice@mar77i the issue is that if you want to take advantage of pattern matching then every function has to have the same name but with a different pattern to match against so you end up having to make a generic name. if you are in a different language you might for example instead of pattern matching write some if-statements that tease out what exactly the data is in each case and then send it to an appropriately-named function. You can do the same thing in Elixir where every version of the function calls a different function with a clear name but then you either duplicate the pattern match in the new function or you leave it out and someone accidentally could pass the wrong data to it and so you either are duplicating code everywhere or not making your code actually-safer.