Categorization of warnings

Mathias Lang via Digitalmars-d digitalmars-d at puremagic.com
Mon Mar 28 14:07:11 PDT 2016


On Monday, 28 March 2016 at 16:21:15 UTC, Johan Engelen wrote:
> I just submitted a PR [1] that catagorizes warnings, such that 
> you can do something like this:
> dmd -w -Wno-not-reachable
> which would error on any warning except the "statement not 
> reachable" warnings (it completely disables that warning).
>
> The motivation for the selective disabling/enabling of warnings 
> was a recent discussion in the Learn forum [2].

Glad tsbockman put you on the tracks :)

On Monday, 28 March 2016 at 18:47:15 UTC, Jack Stouffer wrote:
> But the import issues weren't solved with warnings, they went 
> strait to deprecation.
>
> And I'd argue that warnings are an unnecessary step in the 
> deprecation process. IMO the deprecation -> undocumented -> 
> removed cycle for Phobos works well. Adding another step to it 
> needlessly delays the inevitable (how long has array.sort been 
> a warning?), and I don't see why the same process won't work 
> for DMD.

A language change has much more impact than a Phobos change. 
Plus, Phobos cannot issue warnings.

The deprecation process needs multiple phases:
- One to prevent new code from using this, and spreading the word
- One to make it fail by default but still allow the end user to 
keep old code working
- And at the end you finally kill it

A warning is an indication that something is probably wrong with 
your code (if you exclude statement not reachable, which has some 
false positive, but could still prevent bugs like "goto fail").
A deprecation is not a problem. It's a note left to the user. 
I've yet to see a repo where deprecation as error is enabled.


More information about the Digitalmars-d mailing list