PSA: now if you run roc dev
, it works like roc check
except that if the check finds 0 errors, it then runs the program
previously roc
(with no subcommand) almost did this, except that it would still try to monomorphize the program even if it found type mismatches, which often led to crashes (which it should not in the long-term, but it does for now because there are still some bugs in the "didn't type check but let's monomorphize anyway" code path)
the plan is to repurpose roc
-with-no-subcommand exclusively for running hashbang scripts (e.g. the .roc
file starts with #!/usr/bin/env roc
), because that's the most compatible command to use for that purpose; some env
implementations don't accept multiple arguments, so #!/usr/bin/env roc run
(for example) wouldn't be supported in those environments
so if you want the "type-check and then immediately run if there were 0 errors" behavior, roc dev
is now the way to do that!
also, shout-out to @Ayaz Hafiz for fixing the old approach to this feature which frequently did unnecessary work and then crashed :big_smile:
it's much nicer now!
Will there be a way of doing the same but with build
instead of run
?
hm, what would the use case be? :thinking:
so right now if you say build
, it reports the errors and then builds the executable anyway
the idea behind not running if there are errors is to save the time of killing the program after it starts running
but when doing a build
it just creates an executable but doesn't run it, so that advantage wouldn't really apply!
Last updated: Jul 06 2025 at 12:14 UTC