testing for deprecation

user1234 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 29 00:57:03 PDT 2017


On Tuesday, 29 August 2017 at 05:03:39 UTC, Sebastien Alaiwan 
wrote:
> On Thursday, 1 September 2016 at 11:11:15 UTC, Cauterite wrote:
>> How does one test whether a symbol is deprecated? I would have 
>> expected something like: __traits(isDeprecated, foo).
>
> Such a trait makes it possible to write code that will break, 
> just because something has been marked as deprecated.
>
> Doesn't it break the purpose of deprecation?

Yeah.

static assert (!__traits(isDeprecated, foo), "i could use the -de 
switch as well");

I don't see any real-world usage for this trait. That being said 
the amount of work to implement this in the compiler is trivial. 
I would tear down the feature + its tests in half an hour i think.


More information about the Digitalmars-d-learn mailing list