Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement switch expression in expression language, not YAML #90

Open
johnstairs opened this issue Oct 24, 2023 · 0 comments
Open

Implement switch expression in expression language, not YAML #90

johnstairs opened this issue Oct 24, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@johnstairs
Copy link
Member

Computed fields are currently an embedded expression language within a YAML file. switch expressions (to work with unions and optional types) are not expressed in this language, but rather as YAML nodes:

optionalNamedArrayLength: # YAML
  !switch optionalNamedArray: # YAML
    NamedNDArray arr: size(arr) # YAML-type-expression hybrid
    null: 0 # YAML-type-expression hybrid

This does not allow switch expressions to be used as part of larger expressions (type conversions, a function call argument, etc).

Instead, we should consider making switch part of the expression language. The example above might then look like:

optionalNamedArrayLength: |
  switch(optionalNamedArray) {
    NamedNDArray arr: size(arr)
    null: 0
  }

On the other hand, this syntax introduces curly braces within a YAML document, where indentation is usually favoured.

@johnstairs johnstairs added the enhancement New feature or request label Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant