[Issue 14670] New: Allow Algebraic to ascribe names to fields

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jun 9 10:15:54 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14670

          Issue ID: 14670
           Summary: Allow Algebraic to ascribe names to fields
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: andrei at erdani.com

Algebraic should allow access to its constituents by name, just like Tuple
does. Example:

alias JsonPayload = Algebraic!(
    bool,
    double,
    long,
    string,
    This[],
    This[string]
);

Instead of using get!bool, get!(This[string]) or get!0, get!5 etc., definition
should allow inserting names for each:

alias JsonPayload = Algebraic!(
    bool, "asBool"
    double, "asDouble",
    long, "asLong",
    string, "asString",
    This[], "asArray",
    This[string], "asObject"
);

--


More information about the Digitalmars-d-bugs mailing list