elixirmoney / money

Elixir library for working with Money safer, easier, and fun... Is an interpretation of the Fowler's Money pattern in fun.prog.
https://hex.pm/packages/money/
MIT License
826 stars 139 forks source link

Question - Is there a specific reason Money.divide is not called Money.split? #207

Closed simpers closed 9 months ago

simpers commented 9 months ago

Hey!

First off, great library! Thanks for providing it!

Sorry of this has been discussed before, but I have some thoughts regarding Money.divide.

I wonder if it would be possible to rename the current behaviour of divide to split, as the name of that function right now is quite confusing. Split is a more appropriate name for this if we look at other examples, such as String.split or Enum.split. Both of these behave differently, but they operate on collections and return collections. Lists in this case. But I wouldn't expect a function named divide to do that, as I'd expect it to do the math operation of division instead.

What are your thoughts? Any particular reason divide was chosen that I just don't know about? :)

Edit: Nevermind, I was confused by another library also called Money, but where the app is :ex_money.