You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This allows basic conditional logic in const-evaluation blocks.
Examples
const FOO = ${if 3 > 2 then XYZ else "whatever"}
Language Changes
Parser and Lexer Changes
These expressions must be added to the grammar. Parenthesis may be required or optional, depending on parsability. Even if they are optional, they may be required or at least useful to use for complex expressions.
Behaviour
The new expression is defined as: if X then Y else Z, where Y will be the result of the expression if the integer X > 0, otherwise Z will be the result.
If X is not an integer, this fails.
Compiler Implementation
Compiler Interface Changes
None
Decompiler Changes
None
How to teach
Add to meta programming sections
Alternatives
Different syntax
Backwards compatibility
None
The text was updated successfully, but these errors were encountered:
Summary
Add a ternary if-else construct to const-evaluation expressions.
Dependencies
This needs the following features to be implemented first:
Motivation
This allows basic conditional logic in const-evaluation blocks.
Examples
Language Changes
Parser and Lexer Changes
These expressions must be added to the grammar. Parenthesis may be required or optional, depending on parsability. Even if they are optional, they may be required or at least useful to use for complex expressions.
Behaviour
The new expression is defined as:
if X then Y else Z
, whereY
will be the result of the expression if the integerX > 0
, otherwiseZ
will be the result.If
X
is not an integer, this fails.Compiler Implementation
Compiler Interface Changes
None
Decompiler Changes
None
How to teach
Add to meta programming sections
Alternatives
Different syntax
Backwards compatibility
None
The text was updated successfully, but these errors were encountered: