goto but improved ================= * Use `section l` instead of `l:` * Disallow implicit fallthrough. Could have an explicit `fallthrough` keyword (also for `case` blocks) * Allow only goto to within the same or a containing block. * Sections have access to the variables of the "main" part of the block that it belongs to, but variables that aren't guaranteed to be initialized at all `goto` or `fallthrough` statements. * Allow goto within the nearest `switch` block. Perhaps with the syntax `goto case c` * Should `section`s be allowed in any block, or only at the outer `code` block? - won't work with `else` - won't work with `loopend`/`loopempty` - won't work with `switch (and somewhat redundant anyway) - also, it could be confusing. better break up the code in multiple functions? Syntax test: func example int x code if x >= 100 goto section fail end # or, maybe: require x <= 99 else goto section fail switch x case 1 do_stuff "A" fallthrough case 2 do_stuff "B" goto case 1 case 3 do_stuff "C" goto default case 4 do_stuff "D" fallthrough default do_stuff "other" end return true # Implicit fallthrough not allowed! section fail error "Oops" return false end Syntax test with assertion failure section: func example int x code assert x <= 99 ... return true section assert_fail error "Oops" return false end