www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9395] New: Allow deprecated statement in enum members

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9395

           Summary: Allow deprecated statement in enum members
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-01-25
17:48:41 PST ---
Let's say you have an existing enum in your library API:

enum SpanMode
{
    depth,
    breadth,
    shallow,
}

At some point you may decide you want to rename some of the members, but want
to avoid code breakage for at least some time. You could introduce additional
members which have the same values as the old ones:

enum SpanMode
{
    deep,  // new
    wide,  // new 
    shallow,

    depth = deep,  // old
    breadth = wide,  // old
}

This will work with switches, final switches, to!string, etc (although code
that depends on EnumMembers!E.length could potentially break depending on what
it does).

Don't mind the naming choice (it's just an example), but it would be useful to
allow a deprecated statement in there, ala:

enum SpanMode
{
    deep,
    wide,
    shallow,

    deprecated("Please use SpanMode.deep")
    depth = deep,

    deprecated("Please use SpanMode.wide")
    breadth = wide,
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 25 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9395


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code dawg.eu


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-06-15
08:00:30 PDT ---
*** Issue 10362 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 15 2013