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: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Andrej Mitrovic <[email protected]> 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: -------