Live data from Hacker News

Lovely Week with Elixir

ramblingcode.dev

71–80 of 139 posts

Re: Lovely Week with Elixir

#71

Elixir is decent and I've worked with it a fair amount in production systems... Mostly Rubyists seem to really click with it. And ruby idioms are all over it - you can taste its history and proximity to ruby's ecosystem. As a scala dev that ended up working with elixir for a couple years, my opinion is that a typesafe elixir-like language would really bring BEAM back into the mainstream. Akka is alright but it's shoe…

The older I get the grumpier runtime errors make me. I want ReasonML (language!) and Erlang (OTP!) to have a baby, and I want it birthed by the Go runtime. (Go? Yeah, Go. I don't love the language, but I am a lover of low latency and garbage collection, what can I say?) Yes, there's Gleam, but if something's based on BEAM, the throughput generally won't impress. :-( Would seem a shame to do all that static typing, an…

> but if something's based on BEAM, the throughput generally won't impress

I'm not sure where you're getting that from- that's typically the area it does well. It's bad at number crunching, but you if the work is IO bound (say, like a web application backend) it offers consistently low latency with high throughput.

Re: Lovely Week with Elixir

#72
post #65

Earlier quoted context omitted.

Interesting. I really like Python and SqlAlchemy. Changing objects in the database via changesets and applying them on top of eachother feels kinda alien, when I can't do object.property = something. The thing that confuses me most about Phoenix and Elixir is how do I actually deploy the application to production? I have my own server where I can run whatever I want (running Ubuntu), so what do I have to do to get my…

Use edeliver https://github.com/edeliver/edeliver

I would strongly caution anyone new to the language against using edeliver. There are a lot of gotchas and edge cases with the scripts that can really bite you. It's super cool if it just works, but miserable if something breaks.

Re: Lovely Week with Elixir

#73

Earlier quoted context omitted.

"I think there's a sweet spot for a language that accepts mutability inside of actors, but only allows immutable objects to be sent as messages, with an escape hatch available if needed." That's kind of what akka is on scala or java. Messages are immutable _BY CONVENTION_ but you can do whatever you want.

Isn't that the basis/point of the actor model? Actors can message each other and processing the message can trigger state mutation of the recipient, but they can't directly mutate each other.

All data is immutable on the BEAM with a few exceptions, so no mutation within actors.

Re: Lovely Week with Elixir

#74

Earlier quoted context omitted.

Check out the Elixir "protocol" feature, it's similar to interfaces: https://elixir-lang.org/getting-started/protocols.html

I've used protocols, and they are useful as a kind of bare minimum interface/implementation abstraction. But they're nowhere even close to something like Rust traits. Which is totally fine given Elixir's goals.

I'm pretty deep into Elixir and have been learning a bit of Rust on the side this year, so this is interesting. Could you elaborate a bit?

Re: Lovely Week with Elixir

#75
post #11

The fact that it's a dynamic language make problems similar to Node / Python, can't dev serious backend services without a strongly type language. Not saying you can't, but you will have a lot of issues overtime that would have been catch at compile time.

Compilers aren’t a panacea of avoiding problems in production. You just experience different types of problems.

There’s entire classes of short term and long term issues that you get to avoid by working within the BEAM.

Re: Lovely Week with Elixir

#77
post #23
post #6

Earlier quoted context omitted.

Dude, LiveView is wild . It feels kind of magical, and I think people are gonna start adopting slowly, then all at once. There's an awesome blog post on their website. where Chris McCord, creator of Phoenix, builds a real-time Twitter clone in 15 minutes. https://www.phoenixframework.org/blog/build-a-real-time-twit...

I've been watching Elixir/Phoenix/LiveView from the sidelines, reading just enough to salivate a little but still left with the feeling that my use-cases wouldn't be adequately covered by it. Which kind of SPAs wouldn't work well in LiveView? I'm working on an app in Ember right now where a lot of data is fetched by the client asynchronously and then either showed once its fetched or only when the user pushes a butto…

I'm honestly not sure. I would ask on the Phoenix [1] forums -- they're pretty active, including a lot of responses from Phoenix's creator, Chris Mccord.

[1] https://elixirforum.com/c/phoenix-forum

Re: Lovely Week with Elixir

#78

The BEAM is a huge win: having lightweight threads means you can often do away with things like Redis for job queues and PubSub stuff. I love this answer on StackOverflow by Elixir's creator: https://stackoverflow.com/questions/32085258/how-can-i-sched... So simple. Something that would require a job queue and a job runner fades away into a piece of the OTP application tree. When it crashes, it will even come right b…

How is that stackoverflow answer good?

You lose everything about the scheduled jobs when your app crashes.

This doesn't even address the rampant memory leak issues that plague long running genservers.

Re: Lovely Week with Elixir

#79
post #69
post #64

Earlier quoted context omitted.

1. It's a functional thing, it's quite nice after you use it for a bit, and really powerful because you can use it for any data, and not just when working with a DB. 2. There are several ways. You can use releases [1]; copy the code to the box, run mix release, then ./app start, and point whatever you want to that process. If you're running phoenix you could always compile it on the box and just run mix phx.server. I…

+1 for distillery, very convenient... https://github.com/bitwalker/distillery

Once `mix release` was added natively to Elixir in 1.9, I haven't found the need to use distillery anymore. Is there still a use case?

Re: Lovely Week with Elixir

#80

I learned Elixir a few weeks ago as a quarantine self-improvement project and pretty much loved it. There are some warts, as in any language. As someone who's primarily worked in Go and Java in the past and has also been learning Rust I don't super love the optional typing thing, and I end up missing higher-level data constructs like interfaces and traits. But there are some great language features, like guards and p…

Interesting. I really like Python and SqlAlchemy. Changing objects in the database via changesets and applying them on top of eachother feels kinda alien, when I can't do object.property = something. The thing that confuses me most about Phoenix and Elixir is how do I actually deploy the application to production? I have my own server where I can run whatever I want (running Ubuntu), so what do I have to do to get my…

I like to deploy using Releases as detailed here (https://hexdocs.pm/phoenix/releases.html).

This gives you folder packaged with everything you need to run the application on the architecture you compiled it on. Very straight forward.

If you want to set it up to be a systemd service I guess it would be like any other binary command for systemd. I usually run things under something like Supervisor (http://supervisord.org/)

Post reply on HN