Skip to content

Implement statements-as-expressions #17

Description

@WillBAnders

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions