Since what you're going for here isn't so much an enum as a type union, why not 
simply call it a union? Pro: Unambiguous and already a known concept. Con: It 
adds a keyword, and use of 'union' might interfere with existing set procedures.
    
    
    type
      Option[T] = union
        of None: discard
        of Some: T
      
      Either[A, B] = union
        of Le: A
        of Ri: T
      
      BinaryNode = object
        a, b: ref Node
      UnaryNode = object
        a: ref Node
      
      Node = union
        of BinaryOpr: BinaryNode
        of UnaryOpr: UnaryNode
        of Variable: string
        of Value: int
    
    
    Run

Reply via email to