Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roc CLI workflow #6637

Open
lukewilliamboswell opened this issue Apr 11, 2024 · 0 comments
Open

Roc CLI workflow #6637

lukewilliamboswell opened this issue Apr 11, 2024 · 0 comments
Labels
cli enhancement New feature or request good first issue Good for newcomers

Comments

@lukewilliamboswell
Copy link
Collaborator

Zulip discussion thread

At present there are various commands and options for working with the Roc CLI. The difference in behaviour between options can be unclear, e.g. roc run verse roc dev.

The motivation behind this change is to align the behaviour of the CLI around two primary workflows, while still providing flexibility to use the available features through the use of flags.

  1. RUN WORKFLOW we prioritise ease of use and productivity for the application author. This workflow is most useful when developing a script or application. Scripts and applications will run even if they are invalid and crash at runtime instead of at compile time. Assertions using inline expect will be checked, and dbg values are printed to stderr. The compiler defaults to using the development backends and surgical linker when available as this will build faster, at the expense of runtime performance.
  2. BUILD WORKFLOW we prioritise safety and performance of the produced executable or library. This workflow is most useful when building an application for packaging and distribution. Applications will not build if they are invalid and there are any errors, though warnings are still printed. Inline expect or dbg are ignored and stripped from the produced binary. The compiler defaults to using the LLVM backend with full optimisations.

This task is to modify the Roc CLI workflows as follows;

RUN WORKFLOW

  • The command is roc (modified from current implementation)
  • Prioritise ease of use and productivity, panic/crash at run time
  • Run using dev backends by default (fallback to llvm without optimisations)
  • Prints Errors and Warnings
  • Prints dbg values
  • Proceed to run an invalid program
  • Check inline expect assertions and panic/crash if any fail
  • Supports scripting use-case with !#/usr/bin/env roc
  • Note roc run and roc dev commands removed as redundant

BUILD WORKFLOW

  • The command is roc build (modified from current implementation)
  • Prioritise safety and performance, panic/crash at compile time
  • Build an executable using llvm with full optimisations by default
  • Print any Warnings
  • Reports any Errors and will only build a valid program
  • Ignores dbg and strips from binary
  • Ignores expect and strips from binary

FLAGS

Below are some of the changes to flags that are related to this change.

  • --watch (new flag) (re)compile binary on any changes in the application [NOTE this flag needs further discussion and should be left for a future task]
  • --backend <llvm/dev> (new flag) compile binary using llvm or dev backend instead of default
  • --opt <none/size/speed> (new flags)
    • --opt none compile without optimisations, llvm only
    • --opt size (renamed from --opt-size) smaller binary, llvm only
    • --opt speed (renamed from --optimize) compile with optimisations, llvm only
@lukewilliamboswell lukewilliamboswell added enhancement New feature or request good first issue Good for newcomers cli labels Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant