Roc version 0.1.0, eight years in the making (opens external site)
View full thread · View on Hacker News
To get push notifications on iPhone or iPad, add Hack and Chat to your Home Screen: tap Share → Add to Home Screen, then open the installed app and enable push in Settings.
View full thread · View on Hacker News
I'd love to understand the point.
Replies (5)
Using zig or rust or something you lose the roc specific features of a high performance pure functional language
Much better than FFI where usage is not tracked in the type system
Replies (1)
Replies (2)
You could just pick up Roc, pick a platform, and start writing Roc right away without knowing any other language :) There are already a number of platforms to use for CLI apps, web servers, web apps, native GUIs etc.
However, if you want to write your own platform you can. That's a great power to be able to reach for if you want to but it's not typical.
Going back to the JavaScript example: most JS developers just pick a platform, like Bun, and start writing JS. In the same way, you'd pick a Roc platform and start writing Roc.
Sure, if Bun wasn't good enough the JS dev may write their own platform (Bum? :P), and then they'd need a second language. That's the same thing you could do in Roc if you wanted a custom platform :)
You can't: print("Hello") without a kernel, drivers and libc - doesn't mean python or ruby are useless languages.
Someone in this thread described it an app framework that provides the IO primitives.
I have not used Roc at all just my impression of what's going on
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)
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)
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)
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)
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
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.
The main advantage it provides is restrictions. Roc cannot perform any side effects outside the ones provided by the platform and has no provision for unsafe behavior. This allows for very aggressive inlining at the language level which winds up being pretty close to what I've done with macros and compile time programming in other languages. In terms of system design, you can know that the app code can't break the abstraction boundary and design accordingly. I made an experimental web platform that had full and automatic cache invalidation which worked off a combination of sqlx-style compile time inspection of queries combined with SQLite's security hook callbacks and I never would have done the design without having to deal with platform design. Neither of these are doable if the entire thing is in Rust.
1. The platform defines what effects your code can run. For certain use cases, it makes sense to have some but not the other. For example, a terminal app, a GUI, and a webserver need different primitives. Same with powering a UI for a smart fridge VS embedding into a text editor.
2. Most high level languages "drop down" to systems languages like C/C++ already, for example, Python.
> Might as well just use those languages to finish it off.
Different languages give you different things. Most people wouldn't want to write their entire app in C, for all the obvious reasons. Think about the Apache web server approach - it's a fast server written at the systems level, but passes the final piece off to whatever language you want. You can use a higher level language here for your business logic, without sacrificing all the speed.
At the end of the day, everything has to drop down to assembly to make a syscall, but that doesn't mean you want to write your whole app in assembly.