Hacker News new | past | comments | ask | show | jobs | submit login
Learn OTP with Gleam (github.com/bcpeinhardt)
43 points by todsacerdoti 9 months ago | hide | past | favorite | 14 comments



Modern type system over BEAM sounds great but unfortunately OTP is still not 100% supported https://github.com/gleam-lang/otp?tab=readme-ov-file#limitat...


OTP will never be 100% supported, it's an application framework for a dynamically typed language and as such much of it doesn't make sense in a statically typed language.


I like Gleam over Javascript, but Elixir seems much more expressive to make use of OTP


Hm, see I like OTP and Elixir is nice, but I feel like the lack of types is holding me back a bit.

Could you elaborate on how you find Elixir more expressive here?


Elixir has other ways to express constraints, e.g. pattern matching and guards. I can't judge if it's equivalent in principle to a type system like Gleam's but in practice I find it rather easy to work with and solve issues I use types for in e.g. Java.


It's not quite equivalent but I believe it's the basis of the type system being developed for erlang so definitely contains a lot of the same information.


So pleased to see this. Had fun playing with the language but at the time learning OTP seemed a big ask


Playing with the process 'primitives' is a good introduction, i.e. spawn, send, receive, self.

Those are enough to get started with processes, including setting up two-way connections by sending local PID with the self function so the spawn:ed process knows where to send responses.

GenServer/gen_server is more or less a convenience wrapper around those, that makes more complicated processes easier to design but harder to get started with.


Maybe a dumb question, but, is OTP "Open Telecom Platform" in this case?


Yep clearly not obvious, I was also pondering if One Time Password. Would be a rare case where editoralizing the title could be handy


Not familiar with this area but also thought it was another tutorial about making an OTP authenticator.


If I had not know that Gleam was built on top of Beam I would have had no idea which OTP was referred to.


Yes, Gleam runs on the BEAM and has bindings for that OTP


Gleam reimplements (a large portion of) OTP and is interoperable with Erlang/Elixir code that uses OTP, rather than providing bindings.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: