Stream: beginners

Topic: ✔ exceptional


view this post on Zulip Shritesh Bhattarai (Oct 21 2021 at 17:42):

Reading roc-for-elm-programmers.md, the only thing I could find about runtime exceptions is the numeric overflow. Are panic/aborts exposed to the app code anywhere else?

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 17:48):

In roc, if there is a panic, it is sent directly to the platform/host and the app doesn't see it. Otherwise an error is returned to the app. Like in the case of getting an element from a list, you can receive an error that the index was out of bounds

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 17:52):

The distinction is essentially recoverable vs unrecoverable errors. In some cases, you can opt into recieving an error instead of panicing. For example, doing an addition that explicitly checks for overflow.

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 17:54):

Of course, when a host receives a panic, it doesn't have to crash. It can just clean up and continue executing.

view this post on Zulip Shritesh Bhattarai (Oct 21 2021 at 18:09):

In the example of addition, these are "throwing" vs result-ing functions, right?

view this post on Zulip Shritesh Bhattarai (Oct 21 2021 at 18:10):

Also, is there like a "panic" or "abort" function available in userspace?

view this post on Zulip Folkert de Vries (Oct 21 2021 at 18:11):

there is not, though I guess you could just cause an overflow and that would cause a panic and control is given to the platform

view this post on Zulip Shritesh Bhattarai (Oct 21 2021 at 18:16):

Ah! So, runtime exceptions really are just effects, albeit implicit.

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 18:17):

That is a very interesting way to word it...but I guess.

view this post on Zulip Notification Bot (Oct 21 2021 at 18:30):

Shritesh Bhattarai has marked this topic as resolved.


Last updated: Jul 06 2025 at 12:14 UTC