Stream: ideas

Topic: Are `if`s redundant?


view this post on Zulip Trevor Settles (Feb 20 2024 at 05:27):

It struck me today that when and if expressions seem like quite overlapping features. if/elses don't have an exhaustiveness check, but it seems like in most other cases, they aren't orthogonal features. They both are ways to diverge the execution of your program, however, they do seem a least a little different in practical use. Would it be at all advantageous to drop ifs and only use whens?

view this post on Zulip Luke Boswell (Feb 20 2024 at 06:30):

I vaguely remember this coming up in a previous discussion. I think the summary was that we wanted to keep if because its such a familiar tool for most programmers and the wierdness budget. I'll have a dig around and see if I can find it.

view this post on Zulip Luke Boswell (Feb 20 2024 at 07:45):

Ah found it

Anton said:

it was decided to stay with the current syntax :)
https://roc.zulipchat.com/#narrow/stream/304641-ideas/topic/.E2.9C.94.201.20line.20pattern.20match.20.2B.20.60when.20is.60-like.20bool.20structure
https://roc.zulipchat.com/#narrow/stream/304641-ideas/topic/single.20line.20pattern.20matching
https://roc.zulipchat.com/#narrow/stream/304641-ideas/topic/kotlin-like.20decision.20structures
https://roc.zulipchat.com/#narrow/stream/304641-ideas/topic/eliminate.20.60then.60.20keyword
https://roc.zulipchat.com/#narrow/stream/304641-ideas/topic/harmonize.20decision.20structures
https://roc.zulipchat.com/#narrow/stream/304641-ideas/topic/.E2.9C.94.20adjust.20meaning.20of.20else
https://roc.zulipchat.com/#narrow/stream/304641-ideas/topic/Prevent.20.60else.20if.60
https://roc.zulipchat.com/#narrow/stream/304641-ideas/topic/elif.20syntax
https://roc.zulipchat.com/#narrow/stream/304641-ideas/topic/cond-like.20if.20syntax

view this post on Zulip Trevor Settles (Feb 20 2024 at 16:18):

Thanks! I'll look at that. I had assumed I wasn't the first one to think of this, but I couldn't find this

view this post on Zulip Brendan Hansknecht (Feb 20 2024 at 18:04):

We should maybe make an FAQ for this (or some other doc for less frequently asked but useful discussion based answers). Or at least aggregate links somewhere for future reference.

I feel like we have a few topics like this on Zulip that end up being a mix of links and discussion instead of a collected and referenceable thought.

view this post on Zulip Anton (Feb 20 2024 at 18:33):

I've thought before about an overview of pros and cons (sorted by importance) for a certain issue. We could include a very brief explanation with e.g.: "We felt con X carried a lot of weight..." or "Given this balance of pros and cons, we decided to go with...".

view this post on Zulip Anton (Feb 20 2024 at 18:38):

It would also be cool to be able to view discussion per pro/con. Grayed out pros/cons could be used for things that seem like a pro/con but are invalidated with additional context...

view this post on Zulip Brendan Hansknecht (Feb 20 2024 at 18:51):

100%

view this post on Zulip Brendan Hansknecht (Feb 20 2024 at 18:58):

Though we should be careful not to make the great the enemy of the good. As in, that would be great, but it will also be a solid amount of work and aggregating and such. Simple writing a super short summary and collecting links for later world be very good to have and is much easier to do.

view this post on Zulip Anton (Feb 20 2024 at 19:09):

We could create a separate zulip stream "decisions" with topics such as "keeping if", "effect interpreters",... and in each topic we only put a single message with the summary, further replies are prevented/deleted. If people have something to add to the summary they can open a new topic in the ideas stream and discussion there can result in changes to the summary.

view this post on Zulip Trevor Settles (Feb 20 2024 at 19:21):

Where are things like this normally saved? Is there an easier way than searching through zulip to find topics like this? I'm just getting started with roc, and the places I know to look to be able to answer my questions are:

  1. FAQ page
  2. The tutorial
  3. Examples page
  4. Search through zulip
    Having some more effective way of find decisions like these would cut down on people like asking silly questions like this

view this post on Zulip Anton (Feb 21 2024 at 09:52):

Is there an easier way than searching through zulip to find topics like this?

No, I think the separate decisions stream with summaries would be a good improvement, anybody have a better idea?

view this post on Zulip Anton (Feb 21 2024 at 09:56):

I'm going to try setting up RocGPT today and give it access to examples, faq, tutorial, docs... that should be a good start to help people find answers to general Roc questions.

view this post on Zulip Trevor Settles (Feb 21 2024 at 16:12):

That'd be pretty neat!

view this post on Zulip Anton (Feb 21 2024 at 19:03):

RocGPT is up :roc:

view this post on Zulip Anton (Feb 21 2024 at 19:04):

Hallucinations are pretty common but it definitely can help you find answers to your questions :)

view this post on Zulip Anton (Feb 21 2024 at 19:06):

I could upload no more than 20 files so I'm going to look into merging some files later so I can add more knowledge.

view this post on Zulip Trevor Settles (Feb 22 2024 at 03:38):

Anton said:

RocGPT is up :roc:

I tried going to it, but it looks like I need ChatGPT Pro, which I'm on the fence about getting. You should let other people know!


Last updated: Jun 16 2026 at 16:19 UTC