Add option to show deprecated errors as warnings #248

Closed
wants to merge 2 commits into from

5 participants

@michelf

The new option -di treats deprecation errors as informational warnings,
just like -wi show warnings as informational messages without triggering
errors.

The deprecation option uses the same mechanism as warnings use, so the
same counter (globals.warnings) is shared for both regular and deprecation
warnings (when -di is in use). Some methods that print there own errors
now use the global function error() to print them. There is a particular
case in the Lexer where errors are not triggered but counted, in that case
the same is done with deprecation warnings, asuming it was intended
behaviour.

llucax added some commits Jul 12, 2011
@llucax llucax Add option to show deprecated errors as warnings
The new option -di treats deprecation errors as informational warnings,
just like -wi show warnings as informational messages without triggering
errors.

The deprecation option uses the same mechanism as warnings use, so the
same counter (globals.warnings) is shared for both regular and deprecation
warnings (when -di is in use). Some methods that print there own errors
now use the global function error() to print them. There is a particular
case in the Lexer where errors are not triggered but counted, in that case
the same is done with deprecation warnings, asuming it was intended
behaviour.
38a1657
@llucax llucax Make deprecated() smarter
The deprecated() function now checks if a deprecation message should be
emitted at all, so you can now call deprecated() without checking if
global.params.deprecation is not 0 yourself. This makes code easier to
write and read.

Also restore some error messages that had "deprecated" in them but were
really plain errors (things that are not longer legal at all, not just
deprecated).
bf8a430
@llucax

I also created a bug report for this: http://d.puremagic.com/issues/show_bug.cgi?id=7041

@WalterBright
D Programming Language member

We already have so many options for deprecation and warnings, I am hard pressed to agree that adding more will help more than just add complexity.

@llucax

I replied to the bug report because I think is better to track the issue there:
http://d.puremagic.com/issues/show_bug.cgi?id=7041

If you feel more comfortable discussing things here let me know.

@llucax

Please see this pullrequest:
#908

It only includes the patch adding the deprecation() function. I think is good independently of the discussion about adding deprecations as warnings.

@WalterBright
D Programming Language member

I appreciate that you redid it to just add the deprecation function, but it just seems overly complex without any noticable benefit.

@nazriel

What about this? It's 1 year old PR and nothing is happening here.
Also I think it was superseded by #908
@braddr @yebblies ping

@yebblies
D Programming Language member

@nazriel Pull #908 was only part of this one, and Walter is against adding this switch. The pull itself will be much easier to review once it has been rebased.

@nazriel

@yebblies yea, I am just afraid that @michelf is out (notice 0 comments about this PR, or any replies to Walter's opinion about switch). Also I think it was a reason why Leandro created #908 . So it may be a dead, rotting PR

Let's ping @michelf once again ;)

@michelf

All but @nazriel's latest comment (the one with a @michelf) related to this pull request in the last 8 month never landed on my inbox. Perhaps my Github email settings are wrong. I'll look at this.

To put things in context: this pull request comes from a patch sent to the mailing list by @llucax who at the time had no Github account (look who is the author of those commits). I haven't replied here because @llucax finally got a Github account and seemed to do a good job at replying. And since I never saw Walter's last comment (because of broken email notifications) I didn't follow through either when it was left unanswered.

Assuming someone intend to salvage some remaining parts of this pull request (those not in pull #908), I think it'd be best if it was made as a separate pull request. I'll therefore close this request.

@michelf michelf closed this Oct 7, 2012
@llucax

@michelf thanks for creating this pull request for me btw. I will create a new one updated, with #908 fixed and deprecated("message") already merged in I hope Walter rethink about this and we can finally have a really useful deprecated feature in the language.

@llucax

Superseded by pull #1185 now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment