[Proposal] Add Duration Module

45 views
Skip to first unread message

Yordis Prieto

unread,
Apr 9, 2023, 6:29:28 PM4/9/23
to elixir-lang-core
Add Duration module to enhance its time-handling capabilities. Several modern programming ecosystems, such as Rust, .NET, Go, and Java, already have similar modules that prove invaluable to their communities.
https://learn.microsoft.com/en-us/dotnet/api/system.timespan?view=net-6.0

Key reasons to add a Duration module to Elixir:

- Enhanced Time Handling: Complements Elixir's existing time modules for a more comprehensive solution.
- Improved Compatibility: Promotes better interoperability and smoother transitions for developers migrating to Elixir.
- Alignment with Modern Ecosystems: Ensures Elixir remains up-to-date with the features expected from a modern programming language.
- Enhanced Readability and Maintainability: Simplifies working with time intervals, resulting in more readable and maintainable code.

I would appreciate your consideration and feedback on this proposal. Adding a Duration module would significantly improve Elixir's time-handling capabilities, making it an even more attractive choice for developers.

Thank you so much for your consideration.

José Valim

unread,
Apr 10, 2023, 3:20:48 AM4/10/23
to elixir-l...@googlegroups.com
Hi Yordis, thank you for the proposal.

I would like to see it expanded to say how such module you would look like and how it would interact with all the other Calendar modules.

Kip also had a library where the dates and datetimes themselves could be duration and I would want to see them explored too.

Thanks.

--
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 elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/9450ba64-2f80-4ce4-84c4-cfb60d1c952en%40googlegroups.com.

Aleksei Matiushkin

unread,
Apr 10, 2023, 3:59:42 AM4/10/23
to elixir-lang-core

Kip Cole

unread,
Apr 11, 2023, 12:53:28 PM4/11/23
to elixir-l...@googlegroups.com
I do think there is room in Elixir core for something that simplifies interval/duration handling - primarily because time is hard.   I continue to work on Tempo[1] and because its ISO8601 (Parts 1 and 2) compliant perhaps there are some things than it might demonstrate as opportunities for Elixir. I’ve got some major milestones this week on other libs but I will be back hard onto Tempo after that.  José always reminds me that eventually I need to deal with timezones. I think I have a reasonable model in mind for that now, based upon PEP 495 [2]  and I think I’ve got a good model for interval shifts and interval algebra. But its going to take a couple of months before I have another major update ready for public review.  (It is the lib I’m most motivated to get to completed and polished).

I’m always happy to collaborate time and calendar proposals specific for Elixir core if some else can take the lead.

[1] https://github.com/kipcole9/tempo





Reply all
Reply to author
Forward
0 new messages