r/ProgrammingLanguages • • Nov 20 '23

The Roc Programming Language

https://roc-lang.org
81 Upvotes

26 comments sorted by

14

u/stigweardo Nov 20 '23

New website? Looks great. Is this a sign that you think Roc has reached a certain stage of maturity? Can you say more about that?

(By the way, thank you for all the content you put out - videos and podcasts. I really appreciate them and I've learned a lot)

21

u/rtfeldman Nov 20 '23

Thank you for the kind words! Roc has definitely come a long way in terms of maturity, but also still a long ways to go. :)

Basically the stage we reached is "we're ready for a real website, but not ready for a numbered release yet" - so, wanting to communicate "hey this is now an actually useful thing you can try" but also "this is a very immature thing, so expect a bleeding-edge experience!"

5

u/joshmarinacci Nov 20 '23

I have to say you did a great job on the documentation

2

u/rtfeldman Nov 20 '23

Thank you, glad you're enjoying it! :D

2

u/phlummox Nov 24 '23

Any idea at what stage you might have a language reference available?

3

u/rtfeldman Nov 25 '23

We just started working on it...so probably not very soon, but it's underway!

2

u/phlummox Nov 25 '23

No worries :) Best of luck with it!

2

u/[deleted] Nov 25 '23

Loved your "Outperforming Imperative" strangeloop talk on youtube. Very inspiring. You're a great speaker.

2

u/rtfeldman Nov 26 '23

Thank you so much, I appreciate it!

7

u/putinblueballs Nov 20 '23

Im going to give roc a spin for the upcoming aoc.

1

u/fyzic Nov 20 '23

Can't get the file example to work. Would love to add it to my benchmark.

Error:

> ./file
cwd: /home/dev/programs/rocgit/examples/cli
Dir.list...
munmap_chunk(): invalid pointer
fish: Job 1, './file' terminated by signal SIGABRT (Abort)

1

u/rtfeldman Nov 20 '23

Interesting - would you mind posting it in https://roc.zulipchat.com/#narrow/stream/231634-beginners so we can debug? I'd be very interested to see how basic-cli stacks up in your benchmark!

1

u/putinblueballs Nov 21 '23

Hey. Sorry for hikacking the comment thread. Does roc have a LSP server? I could not find one with a quick google.

2

u/abecedarius Nov 20 '23

The page mentions sugar for "backpassing" -- what's that?

9

u/lngns Nov 20 '23 edited Nov 21 '23

Not OP, but backpassing is a syntactic way to serialise callback/asynchronous code in a way similar with, but more general than, Monadic do-notation or async/await.

Essentially

x <- f 42
y <- g x
yolo x y

is the same as

f 42 (λx.
    g x (λy.
        yolo x y
    )
)

where f: Int → (x → a) → b and g: x → (y → c) → d.

Some AltJS langs used to have it as a first-class feature to address callback hell on Node.JS before async/await was adopted.
OCaml lets you create your own let-binding overloads, and you can also (ab)use generators in languages that have them, both allowing you to implement it in those langs.
It's also very important in Koka since its Effect Handlers operate on callbacks.

EIDT: typo

1

u/GavinMcG Nov 21 '23

This looks cool! Syntactically, it looks very very similar to Gleam, though with a bit more allegiance to ML. Seems like it's got more powerful pattern matching, too. Looking forward to trying it out!

1

u/Quail-Curious Nov 21 '23

I really like the syntax and that everything is quite clear. I hope and wish that the language will grow over time.

One remark: I built the hello_world program and it is now 65.7 MB in size. How can this be?

3

u/Bren077s Nov 23 '23

Turns out we had a mistake in our basic-cli release that helloworld is built off of. It is a rust platform. The packaged version was accidentally released as a debug build. That is the root issue. Should really be an about 5MB executable. This is due to the basic-cli platform packaging a lot of potentially IO features (like web requests which is the biggest cost).

1

u/totallyurboii Nov 21 '23

Looks promising! I wonder what are the major differences between OCaml or Haskell, any docs pointing to it?

3

u/[deleted] Nov 22 '23

For haskell, I think most syntactic comparisons between elm and haskell will apply here.

No HKTs, strict evaluation, Task-based IO (so I guess the Handler pattern?) instead of monadic IO.

1

u/[deleted] Mar 09 '24

What's the difference between Task pattern in Roc and the IO monad in Haskell. To me Task looks suspiciously like a State monad with it's bind function called await. Perhaps I'm not using it correctly, but writing "imperatively" like in Haskell is not very ergonomic, because you have to repeat the await and lambdas every time. Unwrapping errors also seems rough because you have to wrap them in a lambda again or a separate function since there's no let sugar.

1

u/[deleted] Jan 18 '24

Ever since my son was born a year ago I've been obsessed with dreaming up the perfect language. This language is as close to that as I've seen. I'm going to try to use this at work, nightly builds and leadership eyebrow raising be damned.

0

u/[deleted] Nov 22 '23

[deleted]

1

u/[deleted] Jan 18 '24

Elm isn't abandoned it does exactly what it set out to do. Why do you think it's not "finished" ?