#117Enums

  • avatar~clovercommented · 2 years ago
    Author
    Owner

    Enums are a list of possible values

    enum Something {
      variant,
      variant2,
    }
    

    Enums can explicit values

    enum Something {
      variant1 = 1,
      variant2 = 2,
    }
    

    Enums can have payloads

    enum Something {
      variant1: int,
      variant2: float,
    }
    

    For now, the tag type will only be limited to int, and the enums must be exhaustive. In the future, I will open proposals for two extensions:

    • string/float representation types
    • non-exhaustive enums

    Milestone: 0.2.0.

  • avatar~clover changed the status to Todo · 2 years ago