Skip to content

Consider some form of extensible enums #409

Open

Description

@zwarich

There are a number of different approaches to making enums more extensible, e.g. extensible sum types, polymorphic variants, and union types. We should survey the landscape of ideas and find one that works best in the context of Rust.

Any concrete proposal should include details of the type system changes (including interaction with other type system features) and in-memory data representation.

Activity

  1. added
    postponedRFCs that have been postponed and may be revisited at a later time.
    on Oct 24, 2014
  2. reem commented on Dec 15, 2014

    @reem

    My take 2 of the original RFC (#402) which addresses many of the issues of the original by stripping most crazy features and adding detailed memory representation and compilation strategy sections: https://github.com/reem/rfcs/blob/join-types/text/0000-join-types.md

    Comments desired and very welcome.

  3. added
    T-langRelevant to the language team, which will review and decide on the RFC.
    on Jan 19, 2018
  4. xfoxfu commented on Oct 14, 2018

    @xfoxfu

    Four years has passed and now Rust has reached 1.0 by long ago. Is there any possibility to discuss union types again? If RFC passed and possible, I'd like to work on the implementation.

  5. added
    A-typesystemType system related proposals & ideas
    A-enumEnum related proposals & ideas
    A-sum-typesSum types related proposals.
    on Nov 27, 2018
  6. jonas-schievink commented on Feb 25, 2019

    @jonas-schievink
    Contributor

    Status update: We have unions now!

    (also see RFC 2008, which introduces the #[non_exhaustive] attribute, also referred to as "extensible enums")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-data-typesRFCs about data-typesA-enumEnum related proposals & ideasA-sum-typesSum types related proposals.A-typesystemType system related proposals & ideasT-langRelevant to the language team, which will review and decide on the RFC.postponedRFCs that have been postponed and may be revisited at a later time.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions