Cyytrus

Cyytrus

Currently, Elixir relies on :timer from Erlang’s stdlib. However, in every company I’ve worked at, I’ve noticed developers manually calculating milliseconds rather than using this library. This results in code that’s harder to read and less semantically clear.

This makes me wonder: why hasn’t :timer been ported to Elixir? Is there community interest in having a native Elixir timer module? I’m seriously considering opening a PR to implement it, but I’d like to understand if there are technical or philosophical reasons it hasn’t been done yet.

Showing Posts 1 to 10

kevinschweikert

kevinschweikert

Welcome! Since 1.17 there’s Kernel.to_timeout/1 which should make calculating milliseconds obsolete

jswanner

jswanner

Welcome @Cyytrus!

There is a recent addition to Elixir to turn durations to milliseconds: Kernel — Elixir v1.20.2

Separately, since we can use Erlang functions directly, there’s no need to port things to Elixir unless something is going to be improved in the process (like developer ergonomics)

LostKobrakai

LostKobrakai

Besides the other answers: Erlang modules are generally not „ported“ just for the sake of a port existing. You can call erlang modules just fine, please do so. No need for a shallow port. The new to_timeout for example exists to integrate with the new elixir duration definition handling.

10
Post #3
BartOtten

BartOtten

There is of course the split of documentation and as such less knowledge of erlang modules. So I do see use in shallow copies.

dimitarvp

dimitarvp

I agree that’s a real problem and have been bitten by it a good amount of times. But I started seeing it as a “git gud” thing. We can’t constantly duplicate code for surface conveniences. API reshaping, using different contracts, hell, even swapping function argument positions so we can do Elixir pipes, all those are somewhat valid scenarios for introducing shims / wrappers. But just because I or somebody else has not tried to look if Erlang stdlib can help them? I’d say it’s not needed then.

hauleth

hauleth

The same can be said about any function in any library. I do not think that “having single place to search for documentation” is valid argument for maintenance burden of wrapping everything.

sodapopcan

sodapopcan

Ya, seems more like a need for better cross-document searching. Easy to say, harder to do, though. I confess that even though I’m all-for not-shallow wrapping, I almost never think to look in the Erlang docs if I can’t find an Elixir function :thinking:

hauleth

hauleth

For that I highly suggest Dash on macOS (or equivalent like DevDocs.io or Zeal). That provides you offline docs search ad you can add all docs you need.

BartOtten

BartOtten

That I do see use is not to say I advocate for shim libs. After all: where to stop, who keeps them up to date, do we adapt to Elixir conventions, will we use opt lists or maps etc etc.

On the other hand: the need to point to Erlang stdlib it’s not that great. The user suddenly has to know ‘their’ conventions, their doc system and ask questions about it at erlangforums.

brkn

brkn

Keeping it up to date might not be hard. I checked the commit history of erlang’s timer module, it has 12 commits that change source code for the last 5 years (I’m counting very liberally, spec and doc changes are included). Most of them are tiny.

— All posts loaded —

Where Next? Top

Trending in Discussions Top

cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
achempion
I’ve been using Emacs as my main code editor for more than a two years. It’s a custom build version although I’ve tried doom emacs and sp...
New
axelson
Hi there! :wave: @frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
georgeguimaraes
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews