logoalt Hacker News

yeetosaurusrextoday at 12:30 AM2 repliesview on HN

I wanted to use functional programming in actual projects and Elixir's lack of static types almost stopped me from picking it up initially.

I tried it out and, although I do miss static types sometimes, immutability and not having to deal with inheritance and other OO abstractions has made the trade-off worth it for me.

Yes some people do claim that pattern matching makes up for the lack of static types. I don't agree with that, but can say that anecdotally the number of type related bugs I notice in *my* Elixir code is much lower than the number of similar bugs I used to write in languages like Python. Whether that's because of common usage of pattern matching, or community adherence to patterns like returning tuples of {:ok, result} | {:error, error}, or something else is anyone's guess.

An important point not in the heading is that gradual typing has been added without any new language syntax.

It's still not statically typed. Maybe it never will be, but this is a step in the right direction and at least they're trying.


Replies

veqqtoday at 1:41 AM

If you're only willing to use languages with the same features, what's the point? Learning how a different paradigm manages without types can be more insightful.

show 2 replies
lo_zamoyskitoday at 12:33 AM

You might find Gleam[0] a better fit.

[0] https://gleam.run/