Interpreter icon indicating copy to clipboard operation
Interpreter copied to clipboard

Implement statements-as-expressions

Open WillBAnders opened this issue 2 years ago • 0 comments

Statements-as-expressions allows some statements (like if/match) to be used as expressions that return a value. This could easily be done by simply converting these to expressions and using Statement.Expression, however that requires hardcoding a list of allowed expressions. There are two open questions related to this:

  • Figure out an effective way to distinguish which Ast/Ir classes are usable as statements/expressions without having to hardcode a list. This has been tried previously with interfaces, which seems manageable but is a little messy with Kotlin.
  • Figure out if/how wrapped classes (like Statement.Expression) can be removed. The current belief is that some wrapped classes like Statement.Component may be necessary for the Analyzer to handle validation; if so there may not be a compelling reason to redesign things here.

WillBAnders avatar May 18 '23 00:05 WillBAnders