Stream: beginners

Topic: Running broken code


view this post on Zulip Aurélien Geron (Aug 02 2024 at 02:04):

Hi there,
I remember reading (or hearing in a talk) that even if your code fails to compile, you can still run it, and it will just crash whenever it encounters the broken part or anything that depends on it. However, when I try to run the following code, it just won't start, even though the broken code is not even called.

app [main] { cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.12.0/Lb8EgiejTUzbggO2HVVuPJFkwvvsfW6LojkLR20kTVE.tar.br" }

import cli.Stdout

f = \t -> t + 3 # expects a number

g = \_ -> f "test" # provide a string, compilation error!

main =
    Stdout.line! "Hello"

view this post on Zulip Aurélien Geron (Aug 02 2024 at 02:06):

Did I misunderstand something? Or is it true at a coarser granularity, e.g., if there's an error in a module, the whole module is broken, but other modules can run until they import the broken module?

view this post on Zulip Brendan Hansknecht (Aug 02 2024 at 03:03):

roc myapp.roc should work, but it doesn't always.

view this post on Zulip Brendan Hansknecht (Aug 02 2024 at 03:04):

We need to deal with more edge cases. I think it used to work better, but more and more complexity has been added to the compiler that ends up breaking before we get to code gen

view this post on Zulip Aurélien Geron (Aug 02 2024 at 21:32):

Thanks @Brendan Hansknecht , would you like me to open a GitHub issue for this, or is it not necessary?

view this post on Zulip Brendan Hansknecht (Aug 02 2024 at 22:11):

If you open issues, I would try to make them minimal examples where it is failing. I think this is a case where we need to track and tackle individual cases. Cause this is probably a pile of bugs rather than a single project.


Last updated: Jul 05 2025 at 12:14 UTC