Stream: ideas

Topic: backpassing arrow syntax


view this post on Zulip Fábio Beirão (Sep 04 2023 at 12:58):

Depending on the background for the beginner, perhaps we can question even the backpassing syntax.
I have a friend who's a c# expert and the first time I showed him the Roc syntax he saw the srr <- File.readUtf8 path |> Task.await and asked, "Why are the arrows going in different directions?"
I think most of us have a left to right mindset. So I just want to throw out there, that if we are going to add some sugar, perhaps we could consider inverting the <- arrow, so it becomes a bit more "natural"

For instance what about using =? which kind of conveys "this is an assignment, but not really guaranteed" ..

str =? File.readUtf8 path
{} =? Stdout.line "str was: \(str)"
File.writeUtf8 otherPath "\(str)!"

view this post on Zulip Anton (Sep 04 2023 at 13:03):

Yeah, I dislike the arrows in opposite directions as well, =? is a nice alternative. I wonder if we discussed something similar in the original backpassing syntax discussion.

view this post on Zulip Notification Bot (Sep 04 2023 at 13:11):

2 messages were moved here from #ideas > |> Task.await syntax sugar? by Anton.

view this post on Zulip Anton (Sep 04 2023 at 13:21):

I wonder if we discussed something similar in the original backpassing syntax discussion.

From what I could find no alternatives to <- were proposed.

view this post on Zulip Brendan Hansknecht (Sep 05 2023 at 02:48):

I really don't like anything with a = in it. This is not assignment. It is a function call. I think we should try to minimize confusing that (even if a new user may assume it is some special form of assignment).

view this post on Zulip Brendan Hansknecht (Sep 05 2023 at 02:50):

Also for =? in general, feels more like the equivalent of .unwrap() or some form of try. So very different from the meaning of backpassing.

view this post on Zulip Brendan Hansknecht (Sep 05 2023 at 02:50):

Personally, I have grown very use to <-, but I guess people may find it even stranger.

view this post on Zulip Anton (Sep 05 2023 at 09:54):

Good points

view this post on Zulip Kevin Gillette (Sep 09 2023 at 02:45):

fwiw, isn't the intent of backpassing to take something abstract and that gets increasingly more complicated/nested with repetition instead appear flatter/simpler by mimicking, specifically, assignment?

view this post on Zulip Kevin Gillette (Sep 09 2023 at 02:49):

The risk of mixing up assignment and parameter passing is fairly benign in this case because Roc doesn't really have assignment in the typical sense at all (it's more like defining a constant expression in most languages).

view this post on Zulip Anton (Sep 09 2023 at 09:15):

Also good points :)


Last updated: Jun 16 2026 at 16:19 UTC