It's great that proper sum types are finally coming! Though I would prefer 
syntax like in 
<https://github.com/nim-lang/RFCs/issues/527#issuecomment-1858943816>, which is 
more ergonomic IMO:
    
    
    type
      Option[T] = enum
        of None()
        of Some(T)
      
      Either[A, B] = enum
        of Le(A)
        of Ri(T)
      
      Node = enum
        of BinaryOpr:
          a, b: ref Node
        of UnaryOpr:
          a: ref Node
        of Variable: string
        of Value: int
    
    
    Run

IME, separate types for the variants are usually not needed (and this syntax 
could define them implicitly, if needed). Implicitly shortening patterns also 
feels like a bad design.

Reply via email to