Live data from Hacker News

Switching to Elixir

leemeichin.com

21–30 of 283 posts

Re: Switching to Elixir

#21
post #8

How do people switch programming languages? Established languages have massive ecosystems. Large set of libraries. For example, I cannot give up MS Entity Framework Core or Hot Chocolate graphql server for C#. Sure, there are alternatives, but nothing as feature complete. Perhaps it is possible for applications that have small set of requirements.

> MS Entity Framework Core

Having worked with both EF Core and Ecto, I would gladly see the back of EF Core. Ecto is flexible enough to basically do everything you would with a raw SQL statement, but still use a relation mapper with it's validations. And if you have freeform output because you're doing a bunch of JOINs or querying a MATERIALIZED VIEW or whatever, you can just pipe that straight into a struct inline without having to declare a definition somewhere.

Re: Switching to Elixir

#24

Coming from F# and only dabbled in Elixir, I find the language unfortunately a bit confusing. For instance, the signature of a function only reveals the name and number of the parameters but not type, so in a big library, it’s quite hard to recognize (mentally) what goes into what and one can only see one plugged the wrong parameters after one had ran and debugged the code. In strict-type language like F#, such issue…

As a language, I wouldn't call it an upgrade over F# (subjective). The main selling point is probably running on BEAM w/ ruby-ish syntax. BEAM is kind of a big deal IMO.

I don't think it compares very well to F# types, but you can use typespecs: https://hexdocs.pm/elixir/1.15.7/typespecs.html

Re: Switching to Elixir

#25

Coming from F# and only dabbled in Elixir, I find the language unfortunately a bit confusing. For instance, the signature of a function only reveals the name and number of the parameters but not type, so in a big library, it’s quite hard to recognize (mentally) what goes into what and one can only see one plugged the wrong parameters after one had ran and debugged the code. In strict-type language like F#, such issue…

Static typing for Elixir is in active development: https://elixir-lang.org/blog/2023/09/20/strong-arrows-gradua...

Yes, it is currently dynamic and yes, that means you won't get much int he way of type information from the language itself, it's not currently a statically typed language.

Re: Switching to Elixir

#26
post #8

How do people switch programming languages? Established languages have massive ecosystems. Large set of libraries. For example, I cannot give up MS Entity Framework Core or Hot Chocolate graphql server for C#. Sure, there are alternatives, but nothing as feature complete. Perhaps it is possible for applications that have small set of requirements.

> MS Entity Framework Core Having worked with both EF Core and Ecto, I would gladly see the back of EF Core. Ecto is flexible enough to basically do everything you would with a raw SQL statement, but still use a relation mapper with it's validations. And if you have freeform output because you're doing a bunch of JOINs or querying a MATERIALIZED VIEW or whatever, you can just pipe that straight into a struct inline w…

EF Core these days is insanely good.

It definitely has an initial learning curve, but once you've built a small sample app, it's quite easy to move ridiculous fast.

It still provides access to raw SQL and can always add in Dapper if you want/need more complicated queries. But productivity is really, really good with very little sacrifice in terms of performance.

Re: Switching to Elixir

#27

Longtime Rubyist here that has worked with Elixir. It is only loosely based on Ruby's syntax - there is a _lot_ more punctuation in Elixir. Also much more explicit passing of parameters, including database connections and error handlers in the case of a Phoenix application. It's also a challenge to deploy OTP along other non-hypervised runtimes. BEAM and Elixir are very cool, don't get me wrong, but after some progra…

> It's also a challenge to deploy OTP along other non-hypervised runtimes.

What in tarnation. Please expand on this one.

Re: Switching to Elixir

#28
post #8

How do people switch programming languages? Established languages have massive ecosystems. Large set of libraries. For example, I cannot give up MS Entity Framework Core or Hot Chocolate graphql server for C#. Sure, there are alternatives, but nothing as feature complete. Perhaps it is possible for applications that have small set of requirements.

> For example, I cannot give up MS Entity Framework Core or Hot Chocolate graphql server for C#.

What? Why? Also, what do you mean nothing is as feature complete as Entity Framework? What about ActiveRecord, Ecto, Django ORM, Knex, even Dapper in C# itself......

Re: Switching to Elixir

#29

Coming from F# and only dabbled in Elixir, I find the language unfortunately a bit confusing. For instance, the signature of a function only reveals the name and number of the parameters but not type, so in a big library, it’s quite hard to recognize (mentally) what goes into what and one can only see one plugged the wrong parameters after one had ran and debugged the code. In strict-type language like F#, such issue…

There is a lot to like about Elixir itself including the nice syntax, which as mentioned in the article is inspired by Ruby and very easy to pickup. The BEAM/OTP is what really give Elixir the edge over other languages that I've used.

In my experience they include many batteries that would be libraries in other languages, and most times those libraries add a ton of complexity, and sometimes a big learning curve; Async anything is a good example.

I think once one works with Elixir for some time, and gets to learn these builtin tools and abstractions they understand the power of the ecosystem as a whole.

Re: Switching to Elixir

#30
“In fact, I might go as far as saying that Elixir gives you a fun language (like Ruby) while leaving out the stateful footguns OOP languages give you. There are no classes, no instances, no inheritance…it's immutable and functional and you're not bogged down by a static type system.”

I want this but with types. I’m convinced strongly typed is the way to go for larger code bases as it hides the magic of a lot of things and is easier to reason about.

Post reply on HN