www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Adding deprecated to an enum member

reply Jeremy DeHaan <dehaan.jeremiah gmail.com> writes:
I got an error today because I added deprecated to an enum member.

Is there a way to achieve this, or am I out of luck? If it isn't 
doable, should it be?

Here's what I want:

enum PrimitiveType
{
     Points,
     Lines,
     LineStrip,
     Triangles,
     TriangleStrip,
     TriangleFan,
     Quads,

     deprecated("Use LineStrip instead.")
     LinesStrip = LineStrip,
     deprecated("Use TriangleStrip instead.")
     TrianglesStrip = TriangleStrip,
     deprecated("Use TriangleFan instead.")
     TrianglesFan   = TriangleFan
}


PrimitiveType ptype = LinesStrip; //error, Use LineStrip instead.
Jul 31 2017
next sibling parent reply dark777 <jeanzonta777 yahoo.com.br> writes:
On Tuesday, 1 August 2017 at 01:12:28 UTC, Jeremy DeHaan wrote:
 I got an error today because I added deprecated to an enum 
 member.

 Is there a way to achieve this, or am I out of luck? If it 
 isn't doable, should it be?

 Here's what I want:

 enum PrimitiveType
 {
     Points,
     Lines,
     LineStrip,
     Triangles,
     TriangleStrip,
     TriangleFan,
     Quads,

     deprecated("Use LineStrip instead.")
     LinesStrip = LineStrip,
     deprecated("Use TriangleStrip instead.")
     TrianglesStrip = TriangleStrip,
     deprecated("Use TriangleFan instead.")
     TrianglesFan   = TriangleFan
 }


 PrimitiveType ptype = LinesStrip; //error, Use LineStrip 
 instead.
I did as follows using deprecated may help you to elucidate in relation to this https://pastebin.com/NEHtWiGx
Jul 31 2017
parent Jeremy DeHaan <dehaan.jeremiah gmail.com> writes:
On Tuesday, 1 August 2017 at 02:06:27 UTC, dark777 wrote:
 I did as follows using deprecated may help you to elucidate in 
 relation to this
 https://pastebin.com/NEHtWiGx
Deprecating an entire module isn't really a solution though. I only want parts of an existing enum to be deprecated when they are used.
Aug 01 2017
prev sibling parent Moritz Maxeiner <moritz ucworks.org> writes:
On Tuesday, 1 August 2017 at 01:12:28 UTC, Jeremy DeHaan wrote:
 I got an error today because I added deprecated to an enum 
 member.

 Is there a way to achieve this, or am I out of luck? If it 
 isn't doable, should it be?

 Here's what I want:

 [...]
It's a bug [1]. [1] https://issues.dlang.org/show_bug.cgi?id=9395
Aug 01 2017