-
Notifications
You must be signed in to change notification settings - Fork 2
Named blocks #10
Copy link
Copy link
Open
Labels
featureThis issue is related to implementing a major feature of the compiler.This issue is related to implementing a major feature of the compiler.language featureAdding a new feature into the language.Adding a new feature into the language.
Metadata
Metadata
Assignees
Labels
featureThis issue is related to implementing a major feature of the compiler.This issue is related to implementing a major feature of the compiler.language featureAdding a new feature into the language.Adding a new feature into the language.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Because the language lacks
goto, breaking out of a nested loop is quite unreadable:Therefore, I think that named blocks should be introduced:
Reasoning behind the syntax:
block <name>andbreak @<name>instead of<name>:andbreak <name>blockshould be an expression, thus one should be able to return a value out of a block.break @loops -1looks maybe just a little weird? Especially when combined with some more complex expression likebreak @loops x + y * 2withkeyword between the label and the result expression:break @loops with x + y * 2@labelalready separates the label name from the expression, especially if it's highlighted differently from normal expressions in editors.