Live data from Hacker News

Why am I interested in Elixir?

underjord.io

131–140 of 183 posts

Re: Why am I interested in Elixir?

#131

Earlier quoted context omitted.

Are there no bad parts?

Deployments are a mess and as it is interpreted, performance is closer to Ruby than Go. I found the community to be pretty disappointing (but YMMV obviously) — it seemed more alternative oriented than the Rust community (which seems more solutions oriented).

Performance is definitely not close to Ruby, this is just blatantly incorrect. Elixir and Erlang can easily hold their ground vs Go.

The BEAM was originally designed to run software for telephone switches. It's often referred to as soft realtime because it is so responsive. It has been battle-tested for now over 3 decades.

Where the BEAM falls flat is pure number crunching but it's blazing fast with binary processing (e.g. string parsing).

A fresh phoenix project where you render a nontrivial template easily reaches sub millisecond response times, without any kind of optimization.

Re: Why am I interested in Elixir?

#132
post #71

Earlier quoted context omitted.

Yeah I'm curious too. I've written about 2,000 lines of code on this course platform so far and everything except for 1 function is synchronous from a "this is my code" standpoint. I only used Task.start once to launch something in the background.

In the Erlang VM, process execution can stop at an arbitrary point and resume later on. This time slicing is done to ensure that no process, takes up too much time. So you must treat your code as asynchronous since if you get a value from another module, then get it again in the next line it might have changed because your process was suspended in between those two lines.

While that is true it does not make a difference for day to day programming, unless you are super accustomed to think about locks.

You can get very far in Elixir without considering the nitty gritty parts of OTP.

Re: Why am I interested in Elixir?

#133
post #12

I'm currently building a video course hosting platform with Elixir / Phoenix and all I can really say is this has been the nicest tech stack I've ever used in 20 years of web development. IMO it really does feel like you get the best of everything (developer productivity, developer happiness, great language for creating maintainable code, OTP and the BEAM bring a lot to the table, it's memory efficient, tracing code…

Are there no bad parts?

The needlessly dynamic typing.

In practice, Elixir data structures are rarely dynamic in nature. All structs have the same fields. Virtually all lists and maps and whatnot you end up writing will have the same type for all elements. Unlike in the JS ecosystem, there is no culture of having functions with, say, optional arguments in the middle, or arguments that can be either a number or a function or a Date object or stuff like that. Unlike the Ruby ecosystem, there's no runtime monkey patching, runtime attribute generation, runtime anything generation. Everything is as robustly typed as your average C# program, but there's no way to write that down.

Or, well, there is, typespecs. And typespecs are imprecise, hard to write, borderline impossible to typecheck (dialyzer errors are shit), and generally just barely worth it because they're so hard to use.

It just feels like.. such a waste. Dynamic typing is nice if it lets you iterate faster, but that's nearly never the case in practical Elixir code, because there's so little dynamism and magic abound (this is a good thing!). At the same time, not being able to see what values a parameter can be, not being able to ever make proper IDE support, for a language and ecosystem that is so static in nature, is just a missed opportunity.

I still really like Elixir, and I agree with the GP's love letter, but I wish it had a friendlier way for me to communicate data structures to the program, future me, and my colleagues. I still hold hope that someone (future me, maybe?) will bolt types onto Elixir in the same way TypeScript bolted them onto JavaScript. It should be easier than TS because of how static-y the entire Elixir ecosystem already is.

(Sidenote: the usual argument against static types in Elixir/Erlang is that static type checking across process boundaries is hard, if not impossible. Genius Haskellers tried it and failed. My answer is that not having type checked messages would solve 95% of my itch. In the end, most lines of Elixir code is single-process, just transformations and function calls like in any other language. I'll be happy to tell the compiler what type I expect a received message to be and crash at runtime if it isn't - just like I do when I get sent a JSON payload over a REST API or IPC or whatever)

Re: Why am I interested in Elixir?

#134

Earlier quoted context omitted.

Deployments are a mess and as it is interpreted, performance is closer to Ruby than Go. I found the community to be pretty disappointing (but YMMV obviously) — it seemed more alternative oriented than the Rust community (which seems more solutions oriented).

Performance is definitely not close to Ruby, this is just blatantly incorrect. Elixir and Erlang can easily hold their ground vs Go. The BEAM was originally designed to run software for telephone switches. It's often referred to as soft realtime because it is so responsive. It has been battle-tested for now over 3 decades. Where the BEAM falls flat is pure number crunching but it's blazing fast with binary processing…

For CPU intensive tasks, performance _is_ close to Ruby, while both Ruby and Elixir are far behind Go. Soft realtime doesn't mean fast, it just means good std deviation on response time and not a lot of missed deadlines. Fortunately as the article points out, there's always Rustler if you need to optimize while still keeping BEAM crash proof.

That being said, I agree that performance for certain IO intensive applications like web servers is very good, way better than Ruby. Subjectively Phoenix feels way, way faster than Rails in development and is much more performant in production.

Re: Why am I interested in Elixir?

#135
post #74
post #21

Earlier quoted context omitted.

The idiomatic way to do that is to match errors in the else branch of the with statement. I've been using Elixir and Phoenix for a customer for a couple of years. It's ok to great, especially when spawning jobs, with some stains. I'm not a great fan of the with syntax. I wish they implemented it as a native statement of the language instead of as a macro. In that way they probably could let us write the same code ins…

I think one of the big points about being a true OO language is that the only way to talk to a process is via message passing. To me, the handle concept makes sense when you consider that it's handling a message in its mailbox.

Yes, I see that but it's an unnecessary complication. All I want to do client side is calling Module.func() and GenServer side I wish I could only def func() instead of all those incantations.

Furthermore GenServers mix client side and server side code in the same module. It's very confusing even after years. It's one of the most unpleasant coding experience of the decade for me.

On the other side I'd steal Elixir's pattern matching implementation and add it to every language. It's everywhere in Elixir and IMHO it's its strongest point.

Re: Why am I interested in Elixir?

#136

Elixir is an absolute joy to use. I love to use it whenever I can and coming from Erlang, boy its a step up! It's just the Phoenix framework for which the initial setup of the project generator feels so opinionated. You have no options, no way to make a template for the generator. Phoenix's LiveView is a great feature and I want to use it. It's just Phoenix itself that feels off for me, not as straightforward as it s…

You can still make a phoenix project without the generator.

I agree though that phoenix feels almost a little too heavy and opinionated.

Re: Why am I interested in Elixir?

#137
post #69
post #67

I just finished writing my own in-house static site builder in Elixir. I come from the Ruby land. If you thought Ruby was awesome, then you would LOVE Elixir. I was hesitant at first, thinking "not another language.." but once I gave it a shot, I stopped looking back. I'm an individual consultant with a very small team. Without Elixir, many projects that I've finished in weeks would have taken me months. This is a se…

> My static site is now way faster than Jekyll or Middleman. What? You mean the generation step is faster?

Yes. Correct.

Re: Why am I interested in Elixir?

#138
post #68
post #67

I just finished writing my own in-house static site builder in Elixir. I come from the Ruby land. If you thought Ruby was awesome, then you would LOVE Elixir. I was hesitant at first, thinking "not another language.." but once I gave it a shot, I stopped looking back. I'm an individual consultant with a very small team. Without Elixir, many projects that I've finished in weeks would have taken me months. This is a se…

That's cool. Why didn't you use Wordpress?

With WordPress, you need a server at all times and the HTML is generated each time you try to access your site. Sure, you can use caching plugins, but it only makes things complex. Eg. You need to now keep those plugins updated at all times, along with WordPress itself. A static site doesn't need a server and can work right off a CDN. It's blazingly fast and it's virtually unhackable. There are no security updates whatsoever you need to keep track of.

Re: Why am I interested in Elixir?

#139
post #138
post #68

Earlier quoted context omitted.

That's cool. Why didn't you use Wordpress?

With WordPress, you need a server at all times and the HTML is generated each time you try to access your site. Sure, you can use caching plugins, but it only makes things complex. Eg. You need to now keep those plugins updated at all times, along with WordPress itself. A static site doesn't need a server and can work right off a CDN. It's blazingly fast and it's virtually unhackable. There are no security updates wh…

Thanks. Not sure why I got downvotes for asking a question though.

Also, I recently built http://blog.winricklabs.com for example which uses my own static site generator. I didn't use wordpress just because it'd be overkill.

Re: Why am I interested in Elixir?

#140
post #73

Earlier quoted context omitted.

Are there no bad parts?

- deployment is terrible like really bad - average performance ( like 10x slower than Java even worse for CPU intensive tasks ) - dynamic language ( this is the worst part ), working on large code base means problems ahead - lot of features from BEAM / OTP that are not that useful and done better on modern cloud platforms ( Kubernetes for instance does a lot of similar things but better and more flexible, apply to an…

> average performance ( like 10x slower than Java even worse for CPU intensive tasks )

Urgh, that's a disaster.

Post reply on HN