Re: testing for deprecation

2017-08-29 Thread user1234 via Digitalmars-d-learn
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

Re: testing for deprecation

2017-08-28 Thread Sebastien Alaiwan via Digitalmars-d-learn
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 deprecate

Re: testing for deprecation

2017-08-28 Thread jmh530 via Digitalmars-d-learn
On Monday, 28 August 2017 at 21:29:31 UTC, Jonathan M Davis wrote: I think that it's pretty clear that a new traits for __traits would be required. Per the documentation, getFunctionAttributes does not include anything about deprecation, and even if it did, it wouldn't be sufficient anyway, b

Re: testing for deprecation

2017-08-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, August 28, 2017 13:08:04 jmh530 via Digitalmars-d-learn wrote: > On Saturday, 26 August 2017 at 07:17:49 UTC, user1234 wrote: > > getAttributes is made for UDAs only. > > Okay, well if you change it to > > deprecated { > void foo(); > } > > void main() { > pragma(msg, __traits(

Re: testing for deprecation

2017-08-28 Thread jmh530 via Digitalmars-d-learn
On Saturday, 26 August 2017 at 07:17:49 UTC, user1234 wrote: getAttributes is made for UDAs only. Okay, well if you change it to deprecated { void foo(); } void main() { pragma(msg, __traits(getFunctionAttributes, foo)); } then you just get tuple(@system) so the issue still stands

Re: testing for deprecation

2017-08-26 Thread user1234 via Digitalmars-d-learn
On Friday, 25 August 2017 at 20:35:52 UTC, jmh530 wrote: On Thursday, 1 September 2016 at 11:13:42 UTC, rikki cattermole wrote: That is a first that somebody wanted it. Bug report please! I just ran across this with deprecated { void foo(); } void main() { pragma(msg, __traits(getAtt

Re: testing for deprecation

2017-08-25 Thread jmh530 via Digitalmars-d-learn
On Thursday, 1 September 2016 at 11:13:42 UTC, rikki cattermole wrote: That is a first that somebody wanted it. Bug report please! I just ran across this with deprecated { void foo(); } void main() { pragma(msg, __traits(getAttributes, foo)); } producing just tuple(). I came across t

Re: testing for deprecation

2016-09-01 Thread rikki cattermole via Digitalmars-d-learn
On 01/09/2016 11:11 PM, Cauterite wrote: How does one test whether a symbol is deprecated? I would have expected something like: __traits(isDeprecated, foo). In the compiler we have Dsymbol.isDeprecated, is that not accessible in any way from code? The only solution I can think of is compiling

testing for deprecation

2016-09-01 Thread Cauterite via Digitalmars-d-learn
How does one test whether a symbol is deprecated? I would have expected something like: __traits(isDeprecated, foo). In the compiler we have Dsymbol.isDeprecated, is that not accessible in any way from code? The only solution I can think of is compiling with -de and using __traits(compiles,