[Issue 21892] deprecation warning on reflection should be suppressed or at least suppressable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 18 17:01:50 UTC 2022


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

Steven Schveighoffer <schveiguy at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at gmail.com

--- Comment #4 from Steven Schveighoffer <schveiguy at gmail.com> ---
Just posting my +1.

My vibe project is logging HTTPStatus exceptions. The HTTPStatus enum has
deprecated all their members in favor of different names.

see https://github.com/vibe-d/vibe.d/pull/2604

Logging an HTTPStatus exception yields more than 1300 lines of deprecation
messages all from *one line of code*, which didn't use the deprecated members
specifically. This isn't useful.

In a case like formatValue, it's not going to be affected by the removal of
those members at all -- it will adapt just fine, because __traits(allMembers)
will not return those members.

I agree with Adam, some way of identifying that your code is immune to
deprecated symbols being removed to suppress the printing of deprecation
messages.

The thing that defeats the purpose of deprecation messages is having pages and
pages of deprecation messages that are invalid. We should at least provide a
way to work around that, especially in a language which heavily caters to
introspection.

Note especially the comment in the above mentioned PR:

> Note that the deprecated enum members in vibe.data.bson/json cannot
> realistically be marked as such, as that triggers thousands of deprecation
> warnings in Phobos when to!T is used together with Json.Type or Bson.Type.

So this problem is actually causing people to NOT USE DEPRECATIONS where they
should be used.

--


More information about the Digitalmars-d-bugs mailing list