Hey Thomas, we usually try to strike a good balance between having as little functions as possible in the standard library (to avoid bloating it) and having enough functions so that your code can be efficient and expressive. In this case, the performance is not different, so adding it would only be a readability concern. Personally, I feel like using "add/2" and negating the second argument is clear enough that it doesn't warrant an additional function to the date-related modules.
Cheers, Andrea Leopardi [email protected] On Thu, Jan 30, 2020 at 1:42 PM Thomas J. <[email protected]> wrote: > Hello, > > I'm a little surprised for having to use a function named `add` (with a > given negative value) to subtract days. > > Why not add subtract functions to make the code easier to read? > > -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/61dd1db0-925c-4cf0-9cd9-5bfa339a9478%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/61dd1db0-925c-4cf0-9cd9-5bfa339a9478%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAM9Rf%2BKg2P1HQUybE%2B%3DLbiBe%2BjCYp0HKsxr%2BOx9N%3D2Tqeg2RwA%40mail.gmail.com.
