mun icon indicating copy to clipboard operation
mun copied to clipboard

`enum` type

Open Wodann opened this issue 5 years ago • 2 comments

Similar to Rust's enum, we want to introduce a strongly-typed enum.

Some important considerations:

  • Introduction of the enum type will also require introduction of pattern matching:
    • [ ] if let expression
      if let Enum::Variant = some_enum { .. } else { .. }
      
    • [ ] match expression
      match some_enum {
        Enum::VariantA => { .. },
        Enum::VariantB => { .. },
        _ => { .. }
      }
      
    • [ ] Variant decomposition
      if let Enum::Variant(a, true) = some_enum { .. } else { .. }
      
  • All variants need to be resolved

When hot reloading, if a variant was removed, we'll throw a runtime error to signal that we could not memory map an existing instance of the enum type.

Wodann avatar Jun 02 '20 09:06 Wodann

struct decomposition and pattern matching should be implemented as well

wackbyte avatar Jun 05 '20 23:06 wackbyte

When adding if let, please make sure to also include && to connect multiple conditions.

blaumeise20 avatar Apr 04 '22 08:04 blaumeise20