Live data from Hacker News

Elixir v1.20: Now a gradually typed language

elixir-lang.org

21–30 of 426 posts

Re: Elixir v1.20: Now a gradually typed language

#21
post #9

Oh shit here I go (and learn Elixir for a whole year (again)) again. I love everything about Elixir, but Elixir constantly makes me doubt myself like no other language. My brain isnt made for functional stuff, but this makes me want to try again. Sucks that it's not really a beginner friendly ecosystem and usually, when having questions answered, people assume you already know a lot about the language.

Do you maybe know some Rust? I'm also not that experienced with FP languages, but Gleam felt familiar enough, due to some Rust-isms, to allow me to focus more on the concepts rather than the syntax. Granted, I spent a few afternoons with it, but if I were to pick a FP language again to wrestle my brain into submission, I'd probably go with Gleam due to familiarity.

I gave up on Rust even quicker than on Elixir haha.

But yea I know about Gleam and I did build some fourier transform stuff with Rust a while back. I like Gleam generally. I am just much much slower with FP and think its extremely unintuituve compared to, say, Go for example.

Re: Elixir v1.20: Now a gradually typed language

#22
post #20

Found elixir intriguing and so Phoenix. Two reasons I put it aside again are: You need Beam and the Elixir. I find that really weird, because I'm used to just the language like in Python, Java, C, Rust. Not something underneath it, too. There is no debugger. The way to debug Elixir is to print stuff to the console, like 40 years ago. No thanks.

Java has the JVM the same way that Elixir has Beam/OTP/...

Re: Elixir v1.20: Now a gradually typed language

#23
post #22
post #20

Found elixir intriguing and so Phoenix. Two reasons I put it aside again are: You need Beam and the Elixir. I find that really weird, because I'm used to just the language like in Python, Java, C, Rust. Not something underneath it, too. There is no debugger. The way to debug Elixir is to print stuff to the console, like 40 years ago. No thanks.

Java has the JVM the same way that Elixir has Beam/OTP/...

And CPython runs Python bytecode, which is basically running in a Python virtual machine.

I am not sure what GP is objecting to.

Re: Elixir v1.20: Now a gradually typed language

#24
post #20

Found elixir intriguing and so Phoenix. Two reasons I put it aside again are: You need Beam and the Elixir. I find that really weird, because I'm used to just the language like in Python, Java, C, Rust. Not something underneath it, too. There is no debugger. The way to debug Elixir is to print stuff to the console, like 40 years ago. No thanks.

That is just wrong.

> You need Beam and the Elixir. I find that really weird, because I'm used to just the language like in Python, Java, C, Rust. Not something underneath it, too

The beam is a VM. You get that Java requires a VM too right? It’s called JVM for a reason. And Python requires an interpreter.

> There is no debugger. The way to debug Elixir is to print stuff to the console, like 40 years ago.

That is false. https://www.erlang.org/doc/apps/debugger/debugger_chapter.ht... and you have observer. And you have a lot of other debugging tools. I hear Java has a good one and maybe it’s better (I never used it) but it’s not true there exist no debuggers for the beam.

Re: Elixir v1.20: Now a gradually typed language

#25

Oh shit here I go (and learn Elixir for a whole year (again)) again. I love everything about Elixir, but Elixir constantly makes me doubt myself like no other language. My brain isnt made for functional stuff, but this makes me want to try again. Sucks that it's not really a beginner friendly ecosystem and usually, when having questions answered, people assume you already know a lot about the language.

I find beginners respond well to this resource: https://joyofelixir.com/toc.html

Re: Elixir v1.20: Now a gradually typed language

#26
post #22
post #20

Found elixir intriguing and so Phoenix. Two reasons I put it aside again are: You need Beam and the Elixir. I find that really weird, because I'm used to just the language like in Python, Java, C, Rust. Not something underneath it, too. There is no debugger. The way to debug Elixir is to print stuff to the console, like 40 years ago. No thanks.

Java has the JVM the same way that Elixir has Beam/OTP/...

Read again...

Here's what you need to do for elixir:

Download and run the Erlang installer Download and run the Elixir installer

Here for Java: Download and run the Java SDK

And for Python: Download and run the Python installer

Re: Elixir v1.20: Now a gradually typed language

#27
post #10

Oh shit here I go (and learn Elixir for a whole year (again)) again. I love everything about Elixir, but Elixir constantly makes me doubt myself like no other language. My brain isnt made for functional stuff, but this makes me want to try again. Sucks that it's not really a beginner friendly ecosystem and usually, when having questions answered, people assume you already know a lot about the language.

https://pragprog.com/titles/lhelph/functional-web-developmen... don't let the title fool you - the first half of the book is just elixir over the past 8 years this is the book i've used to ramp back up on elixir and it works like a charm every time - i've never finished it for me, a mark of a good programming book in this tutorial-project style is that I have started it half a dozen times and never finished it becaus…

I've heard that Phoenix has changed a lot since that book was written. How relevant are those framework specific parts still?

Re: Elixir v1.20: Now a gradually typed language

#28

Oh shit here I go (and learn Elixir for a whole year (again)) again. I love everything about Elixir, but Elixir constantly makes me doubt myself like no other language. My brain isnt made for functional stuff, but this makes me want to try again. Sucks that it's not really a beginner friendly ecosystem and usually, when having questions answered, people assume you already know a lot about the language.

Comments like this always confuse me as object oriented programs riddled with state are much harder to reason about to me.

Re: Elixir v1.20: Now a gradually typed language

#29

Earlier quoted context omitted.

What functional stuff is throwing you off? A whole bunch of it can be written procedurally when starting out.

With Elixir specifically it was the learning experience I had with Phoenix. I didn't understand how a Phoenix app booted, didn't know where to edit my config. Syntax like: ``` socket "/ws/:user_id", MyApp.UserSocket, websocket: [path: "/project/:project_id"] ``` Elixir gives you too much freedom on how to write something on a syntax level which really annoyed me.

I love Elixir and Phoenix, but Phoenix especially uses a lot of compile-time macros and it can be a steep learning curve when you need to pull apart the skeleton framework to figure out how things are actually wired.

I pretty frequently find myself needing to open up the source to understand what's actually going on, the docs aren't bad but it often feels like they assume a lot of existing familiarity with phoenix.

In this example, `socket` is a compile time macro and it's being called with

    path = "/ws/:user_id"
    module = MyApp.UserSocket
    args = [
      websocket: [
        path: "/project/:project_id"
      ]
    ]
and what is does is register that data with the `phoenix_sockets` attribute inside the module you called `socket` from. At compile time that gets turned into a lookup inside your module, and presumable then the UserSocket module is invoked when a websocket request hits the specified path.

Would you find it more clear if socket was called like this?

    socket("/ws/:user_id", MyApp.UserSocket, [websocket: [path: "/project/:project_id"]])

Or, alternatively, would it help if the endpoint was more specifically defined like

    defmodule MyApp.Endpoint do
      use Phoenix.Endpoint, 
        otp_app: :my_app,
        web_sockets: [
          socket("/ws/:user_id", MyApp.UserSocket, [websocket: [path: "/project/:project_id"]])
        ]
    end
Post reply on HN