Live data from Hacker News

Build a real-time Twitter clone with LiveView and Phoenix 1.5

phoenixframework.org

191–200 of 249 posts

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#191
post #75

Earlier quoted context omitted.

There's no magic. It's functionality that's made possible by the BEAM. It's just one of those things that came out of realizing how powerful the runtime was for handling certain types of problems. When you combine a couple of those bits together, you end up with this. The only modern web problem that Elixir isn't ideally suited for is heavy number crunching. Otherwise it gives this amazing balance of efficiency, scal…

I'm of a similar view to them, this felt like lots of magic or at least lots of gotchas I can see myself hitting. I saw two function definition types (def and defp), pattern matching input then requiring a caret for the variable name (?), passing in "assigns" but then referring directly to other variable names, pipes, etc. There's a lot there compared to when I've worked in Erlang.

def and defp are probably the least magical of those. def is for public functions (can be called from other modules) and defp is for private functions (cannot be called from other modules).

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#192
post #183
post #14

I was a Rails user for almost a decade. I switched to Phoenix/Elixir 3 years ago. Elixir is a super simple language. It has no OO concepts and everything is functions first. In fact, it's so good that I started teaching it for universities. All my production web applications are now fully on Elixir. Elixir is one of those languages where everything has been done perfectly as of the time of this comment. When I say pe…

How’s the speed? Is it as performant as technologies like Django / Ruby?

I think calculations are it's weak point, but for the typical message passing application like Twitter it's fast and incredibly scalable.

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#193

Earlier quoted context omitted.

> When I say perfect, I mean, there has been never once in my career where I hit a roadblock due to the language's limitation or complexity or flawed assumption. I faced this with other languages, but not Elixir. This is pretty amazing praise! Are many of the other languages you've used strongly typed? That's the thing that gives me pause - I feel like I rely on the compiler a lot in languages where it can do a lot f…

> Are many of the other languages you've used strongly typed? That's the thing that gives me pause - I feel like I rely on the compiler a lot in languages where it can do a lot for me, and that I'd be really frustrated managing a large project without it. As someone who has been writing Elixir professionally for 4-ish years, and who is otherwise about as big of a proponent of static types as is possible, this is simu…

"hasn't been slowing me down" --> would it slow a new developer who approaches the code base? or 30-100 people who work on the codebase?

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#194

Earlier quoted context omitted.

One of the things I like about Guards is that you can enforce/match against types as needed.

Guards are nice, but compared to static typing, they a run time check whereas static typing alerts you to errors at compile time.

I’m a fan of static types don’t get me wrong, I’m just saying with guards and dialyser it’s 60% of the way there compared to nothing. Also I don’t seem to make to class of errors I do in other languages because 90% of this time passing the wrong thing breaks immediately due to pattern matching.

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#195
post #133
post #112

Earlier quoted context omitted.

I'm the author of Gleam, a statically typed language on the BEAM. What you've said matches my findings. Messages can be typed, however hot code upgrades cannot be. For Gleam we've sacrified hot code loading in exchange for types, which I think is a good trade for most use cases.

Hi, thank you for contributing! I have gotten into the functional programming paradigm conceptually from working with react/redux. We do all of our development work using TypeScript, rather than JavaScript. Typescript isn’t really static typing, but more like type assertions on top of a dynamic language, but hot reloading works fine and is a core component of the workflow, especially with the ability to maintain stat…

The hot loading of code we're talking about is mutating of running code in production, and it involves running multiple different versions of the same code at the same time in order to do a clean and incremental migration to the new version while continuing to serve traffic. It's a different set of constraints to hot loading JavaScript style and very difficult to get right. The nation problem is that you don't have any way of knowing what the the state of the running system is (it is mutable) so you cannot unify your new types with the existing system.

We could probably do hot loading in development using type assertions fairly happily.

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#196
post #181

Earlier quoted context omitted.

Seriously. I would love to work at this level of abstraction in Clojure, but to do something that is trivial in Rails with something like Devise is a chore in Clojure, and you have to put it all together yourself. Of course this makes it excellent for learning, but not so great for deadlines. More and more I think I might've made a mistake trying to do basic CRUD web stuff in Clojure for my current project.

Interestingly one of the creators of Devise is the creator of Elixr

And is currently working on an authentication "framework" (more like generators IIRC)

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#197
post #95

Earlier quoted context omitted.

To add to this, it's worth noting that Elixir would have difficulty _ever_ becoming statically typed because of how message-passing works. For example, if you look at Gleam [0] -- the recent project that's trying to create a statically typed language for the BEAM -- it can't handle message-passing [1]. And I totally agree with you here: > I've found that it's possible to pretend it is a statically typed language if y…

Hi, I'm the author of Gleam. We have fully type safe message passing, we just don't have any special syntax for it. I'll update the documentation to make this clearer.

Thanks for commenting. Do you have any code somewhere that demonstrates type-safe messages?

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#199
post #136
post #14

I was a Rails user for almost a decade. I switched to Phoenix/Elixir 3 years ago. Elixir is a super simple language. It has no OO concepts and everything is functions first. In fact, it's so good that I started teaching it for universities. All my production web applications are now fully on Elixir. Elixir is one of those languages where everything has been done perfectly as of the time of this comment. When I say pe…

Wait, for loops and nested conditions is an OO concept? What does Elixir do instead?

It's not OO per say, but it is an imperative concept, OO is almost always imperative.

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#200
post #5

Looks interesting but I am not interested in making timelines .. is this Phoenix framework general enough to make arbitrary real time web apps?

Yes, think of it like Rails for the Elixir language. Phoenix -> Elixir Rails -> Ruby

But without requiring all of the ActiveSupport patches to the base language!
Post reply on HN