dada-lang / dada

I speak only of myself since I do not wish to convince, I have no right to drag others into my river, I oblige no one to follow me and everybody practices his art in his own way.
https://dada-lang.org
Apache License 2.0
444 stars 28 forks source link

should we avoid executing programs with errors? #220

Open vemoo opened 2 years ago

vemoo commented 2 years ago

While implementing #217 I found that dada run executes even if there are errors, which causes this program to enter an infinite loop:

async fn main() {
    i = 0
    while i < 1 {
        print(i).await
        $ # invalid syntax
        i += 1
    } 
}

I think we should avoid running if we encounter any diagnostic with Severity::Error.

That can also happen for dada test and maybe on web playground?

nikomatsakis commented 2 years ago

Actually, it's my intent that we always run programs, even with errors. Part of the goal of the compiler is to be able to always generate something a user can run.

nikomatsakis commented 2 years ago

However, if we encounter invalid syntax, or other super painful errors, we could have the program abort when it reaches that point in execution.