ta0kira / zeolite

Zeolite is a statically-typed, general-purpose programming language.
Apache License 2.0
18 stars 0 forks source link

Make `break`/`continue` behave as expected with `cleanup`. #85

Closed ta0kira closed 4 years ago

ta0kira commented 4 years ago

For example:

cleanup {
  // cleanup 1
} in while (foo) {
  cleanup {
    // cleanup 2
  } in if (bar) {
    cleanup {
      // cleanup 3
    } in if (baz) {
      continue  // cleanup 3&2 (but not 1) should be executed here
    }
  }
}
ta0kira commented 4 years ago

Based on reasoning from #83, maybe break/continue should also be disallowed inside of cleanup. Even though the reasoning in #83 is specific to return interpretation, #84 proposes treating break/continue as semantically similar to return.