Annoying deprecation messages when using EnumMembers with enum that has deprecated members
H. S. Teoh
hsteoh at quickfur.ath.cx
Wed Oct 9 18:03:50 UTC 2019
On Wed, Oct 09, 2019 at 07:38:34PM +0200, Sönke Ludwig via Digitalmars-d wrote:
> For the particular issue of filtering out deprecated members, I've
> written a little workaround some time ago, using the fact that
> warnings inside of _traits(compiles) are gagged:
> It doesn't help when actual access to these members is desired.
I wonder if it's possible to (ab)use __traits(compiles) to extract
information from deprecated members while gagging the deprecation
messages. Like, arrange for an expression inside __traits(compiles) to
compile or not, based on some desired boolean criteria, then use static
if outside to extract this information. This would be a really nasty
hack, though, so probably should not be used in production!
First Rule of History: History doesn't repeat itself -- historians merely repeat each other.
More information about the Digitalmars-d