Really enjoy working with bits & bytes in Elixir. The syntax looks weird at first but pattern matching against an incoming message via individual bytes is very nice. I've found the gen_tcp / gen_udp stuff's documentation to be a little hard to grok as most of it only gives deep in the Erlang modules but once you "get it" you really get it. It plays very nicely with GenServer's too for super reliable, fault tolerant, tcp/udp acceptor clients. Thanks for the article, this will be a good resource for everyone to learn more about gen_tcp/udp directly!
My "learn elixir" project was writing a full API/client for communication with a NEO-M8 GPS chip via i2c bus. I have never done any i2c hardware programming in my life. Suffice to say I bit off way more than I can chew and it barely works - but it's definitely been incredibly rewarding to use such a high level language to do such low level things with relative ease.
Completely agreed, I had to reverse engineer and communicate with an undocumented telnet interface last year at work. It was a brutal pain until I decided to do it in elixir, where it was merely annoying.
The nomenclature around binary/bitstream/charlist/iolist is fairly messy though. But to be fair I think most or maybe all of that shit is just straight from erlang. OTP is a rock solid standard lib but we used to joke that they just took turns naming modules and functions. "Everyone gets to do one!" There's no consistency.
Compared to the bit packing I had to do in C in the 80s Elixir is a joy.
The bit operations in a pattern-matched functional language is what got me hooked on Elixir.
I would think that a language like Elixir would have latency issues that would be a problem for NTP. I didn't see any discussion of this in the article -- can Elixir be deterministic?
Since the NTP client is usually just drifting towards the server time with clock skew maybe this would only manifest as doing this process a little slower. If latency was even a problem in the first place.