"Scheduled" for deprecation keyword
Jonathan M Davis
jmdavisProg at gmx.com
Wed Aug 1 08:50:37 PDT 2012
On Wednesday, August 01, 2012 17:40:41 monarch_dodra wrote:
> I know of the "deprecate" keyword, but I was wondering: Is there
> a "scheduledDeprecated" keyword?
>
> While I know you can still force-compile with deprecated feature,
> that isn't exactly the same thing.
>
> I'm talking about stuff that is NOT YET deprecated, but soon will
> be. I want to know about this (warning), but maintain the
> behavior that I don't want to use deprecated stuff.
>
> AFAIK, there is no way of knowing this, other than reading the
> doc...
It's just documentation to inform you that you're going to need to change your
code. We put it in the ddoc of the symbol to be deprecated as well as in the
changelog. At one point, we were using pragmas to output messages about it at
compilation time, and that just annoyed people. So, it's just documentation
until the symbol is actually deprecated, in which case, its marked as
deprecated in the source code, and the compiler will start complaining if you
use it and you're not compiling with -d.
The one feature that we'll almost certainly add to deprecated (and a pull
request exists for it but hasn't been merged in yet) is giving it an optional
message.
deprecated("Please use y instead") auto x(int i);
so that we can indicate to the user what the replacement (if any) of the
deprecated symbol is when they try and compile code using the deprecated
symbol.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list