Live data from Hacker News

Lovely Week with Elixir

ramblingcode.dev

101–110 of 139 posts

Re: Lovely Week with Elixir

#101
post #82

Earlier quoted context omitted.

The Kotlin KTOR framework is the most promising new web stack I’ve seen. It doesn’t have the higher level runtime features of Erlang but it checks most of your other boxes.

I like Kotlin but I'd say a strength of BEAM is that it doesn't allow for infinite loops, which means coroutines can't block others. This is a fundamental strength. It allows the runtime to schedule coroutines effectively - they can't block for more than a function call (recursion is how you do "infinite" loops). I think a future competitor to BEAM languages would need this feature.

This is the kind of thing I was referring to by higher level runtime features in Erlang. If you really need this sort of thing then you should probably be looking at an Erlang stack but I think for a lot of projects a less exotic and also much more rigorously typed language is going to be more productive.

Re: Lovely Week with Elixir

#102
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...

Controversial opinion: the "magic" is why I'm staying away. It's the same reason I stopped coding in Ruby/Rails: too much magic. But I'm also a full-stack developer and I'm not afraid to write JavaScript. I realize not everyone is on the same boat, and LiveView might cater to them.

LiveView is a nightmare from a deployment point of view. LiveView stores state on the server associated with the web socket connection. If the web socket connection disappears which is what will happen during a deployment then the user's state will disappear.

The value of LiveView is not having to write javascript but the only way to preserve any non-complicated state in LiveView when the web socket disappears is to write javascript. It is only recently that LiveView added support to automatically preserve form input values across a state crash. [https://github.com/phoenixframework/phoenix_live_view/blob/m... | Recovery form input data automatically on disconnects or crash recovery] Prior, to 0.7.0 if the web socket died while you were typing input values in a form then the page would reload and all your input into the form would be wiped out.

Re: Lovely Week with Elixir

#103
post #73

Earlier quoted context omitted.

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.

No, that's not true. Actors in elixir/erlang mutate their state through tail call recursion through the loop function.

Re: Lovely Week with Elixir

#104
post #13

Earlier quoted context omitted.

God I hope so. I loved Erlang and OTP when I tried it back in the late 00s and it never really caught on, despite many of its strong points being what most websites would look for. Hopefully with the focus on the web and the fresh coat of paint Elixir has given the ecosystem it will eventually gain more adoption. But I still have my doubts because despite looking more mainstream than Erlang, it's still kind of a "fun…

Yeah, it does have that stigma. It certainly did for me; "Why the hell are there colons before these variables..?" It's funny how much the first languages you learn (for lots of people, Java/C/JS) have such an impact on what "feels weird," when every programming language is basically magic anyway.

Well, Ruby and Julia and scheme, I think?) all have those same colons too, so it's not totally crazy. It's the post- colon that's strange (but Ruby has those too)

Re: Lovely Week with Elixir

#105
Like the author, I'm really truly loving Elixir. I recently wrote up some of my experiences with Elixir/Phoenix coming from a Ruby/Rails perspective - https://medium.com/swlh/3-months-with-elixir-phoenix-2810f65....

Curiously, unlike most others here, I'm not completely loving Ecto. I appreciate the philosophy and get changesets, but I'm finding the query syntax clumsy.

Re: Lovely Week with Elixir

#106
post #81

Earlier quoted context omitted.

LiveView will take some time to really get general acceptance and will probably always be somewhat controversial. Both for server roundtrips and because it is so oddly specific and doesn't have a comparable solution in most other languages. But it is fantastic where it fits, truly.

https://news.ycombinator.com/item?id=20383814 exists, so I'd expect it to catch on in other languages if it really is a killer app. I don't know how well such a thing would work without OTP though.

Yeah if you have a minor miscode/footgun in blazor you're really not gonna have a good time. If you have a minor miscode in liveview, OTP's got your back.

Re: Lovely Week with Elixir

#107
The job market for Elixir is pretty small. Sure, there are a couple of people here responding with specific listings, but still. I was hoping it would have ramped up by now but it seems that it's going to stay a niche player.

Re: Lovely Week with Elixir

#108
post #38

Earlier quoted context omitted.

I would argue that if you're looking for a simpler way to build CRUD apps, just skip the middleman and use postgREST. I've been playing with Elixir and Phoenix, and while they're pretty great I like postgREST much better. You eliminate an unnecessary (in most cases) abstraction and backing onto the grown up postgresql authorization and authentication is invaluable for securing your app. For non webapp stuff I've been…

I'd love to hear your opinion on liveview if you've played with it at all. The two ways forward for the industry I see are something like hasura/postgrest with heavy js in the frontend, or something like liveview/blazor. I'd expect the more decoupled approach to win long term, but demos like this: https://github.com/moomerman/flappy-phoenix are extremely impressive.

I commented elsewhere, but I made a quick quirky game with full source code using LiveView.

[0]:https://hn.lddstudios.com/ [1]:https://github.com/ldd/hn_comments_game/

Not to share my views or anything, and I have nothing to sell about it, but I thought I would share it with people anyways

Re: Lovely Week with Elixir

#109
post #24

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…

> 1. Ecto is simply the best DB library I've encountered in any language. I'd almost recommend learning Elixir just to be able to use Ecto. It's interesting, people always talk about Phoenix, which is nice, but Ecto is really special. I often recommend it to anyone who is feeling burned by Active Record implementations.

I thought so too, at first, but now I'm really down on it. Ecto Changesets work fine for flat data, but when you have to deal with nested data, it becomes a nightmare, because you have to use these special functions to read and update the data. Doing that in a nested context just gets really clunky, especially coming from Clojure, where I would just do something trivial, like

    (assoc-in changeset [:children 1 :title] "New title")

Re: Lovely Week with Elixir

#110
post #53

Earlier quoted context omitted.

That’s all true, but I think a Typescript-like system would work really well here. Typescript is very tolerant of the data being different than the type definition, and it doesn’t know or care if your data actually matches the type definition at runtime. It would be up to the developer to account for different versions of the data when writing out type definitions, and the worst case is that you try to access a prope…

I mean, that's already what Erlang/Elixir has, in the form of Dialyzer, a runtime "type linter" (which is what the typespecs in the article feed into.) It's static typing that Erlang can't complete-the-triangle on; not typing generally. The only problem is that "offline" type-checking like this does nothing to solve one of the main use-cases/pain-points where Erlangers want types (or, at least, think they want types)…

It’s a bit of a stretch, but your thoughts reminded me of one of Joe Armstrong’s interests, how to document/prove two components were adhering to the protocol they were using to communicate (he was describing the problems of interconnecting two hardware components in the informal talk I attended, but obviously he had a significant interest in software as well).

I miss Joe quite a bit. Such a keen mind with seemingly infinite curiosity.

Post reply on HN