Unofficial Hacker News companion — get notified on comment replies, and more.

Roc version 0.1.0, eight years in the making (opens external site)

485 points by DrDeadCrash 3 days ago | rtfeldman.com | 134 comments on HN | Vote on HN (opens Hacker News) |

View full thread · View on Hacker News

Comment thread (7)

  1. Platforms are what give you all of the effectful functions you need. It could be a "webserver platform" which lets you answer web requests and talk to a database, or it could be a "TUI platform" which lets you read keyboard input etc. Without a platform you'd just have pure functions, because unlike many other languages, Roc doesn't offer any effectful functions in its std lib. My mind was blown when I realized that! :'D

    Another way to look at it is a practical comparison: JavaScript is a language, but it needs to run on something. If you run it in the browser, you get access to browser APIs. If you run it on the server with Node/Deno/Bun you get different APIs that are useful for web servers. In that scenario, the browser or Node/Deno/Bun is the platform.

    The example above isn't apples-to-apples, but it's a good way to visualize the difference!

    Does that help? :)

    Replies (1)
    1. Somewhat, but it's the fact it doesn't really cut it. Because this could be similar to say the java VM, except the VM has a much bigger scope than a roc platform.

      To me it just seems like roc can't function without other languages to make them useful.

      Please don't take this on a bad way I'm just unable to describe it better.

      Replies (1)
      1. Yeah, I mean, that's just factually true! No harm in that :)

        Roc needs a platform written in another language, but you as a Roc author don't have to read or write that language. You don't even need to know which language a platform is written in.

        Someone else (like me!) writes a platform, shares it, and you use it. That means you get whatever platform you want: maybe with the concurrency of Go? Or the performance of Zig? Or the memory safety of Rust? And the platform can give you access to their entire ecosystem. All that with no effort on your part, and you get to read and write only Roc. Sweet deal, right? ;D

        Replies (1)
        1. Yeah I don't know, there's a lot of trust there though. It just feels weird to me that roc can't run without something written in another language. How do you debug it is the fault lies in the platform, written in a language you don't know? It also seems to say purely functional languages can't do much without a none functional layer. Maybe I'm still not understanding.

          Maybe it's just something I need to get used to.

          Thanks for taking the time to explain though. If you're the guy that created the joy web framework (platform?) for roc, then I watched and enjoyed your talk about it.

          Replies (3)
          1. >It also seems to say purely functional languages can't do much without a none functional layer.

            Well, you could write your platform in a functional language :) What it is saying is that separating pure vs. effectful/impure comes with some nice benefits, and we're seeing that in the platforms concept. I think if you try it you may see it differently :)

            >If you're the guy that created the joy web framework (platform?) for roc, then I watched and enjoyed your talk about it.

            Yeah, that's me! Thank you so much! PS. I call it a "framework" just because it spans more than one platform. Not really an important :P

          2. > It also seems to say purely functional languages can't do much without a none functional layer

            Exactly. At some point, your pure FP code has to hand off a description of some effect (open this file, make this network request, write to std out), otherwise all it can do is maybe heat up your computer.

          3. Most if not all of programming languages you have used recently can't run without a C "platform", ie most of them ultimately link to the C stdlib.