April 26, 2012 Re: Docs: Section on local variables | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On 26/04/2012 22:52, bearophile wrote: <snip> > For uncommon situations like isInputRange a specific annotation > solves the problem cleanly. As does the compiler swallowing warnings in the content of an IsExpression as I already suggested. <snip> > How many C/C++ programmers do you know that use lints? I think not > enough. The Microsoft C++ compiler and Clang are adding more and > more compile-time tests, replacing lints, this a trend D designers > can't ignore. So saying "leave it to lints" it's almost like > saying "ignore the problem". I agree. http://dlang.org/overview.html under "Who D is for": "Programmers who routinely use lint or similar code analysis tools to eliminate bugs before the code is even compiled." My impression from this has been that D aims to eliminate (or at least minimise) the need to use lint-type tools, by making the code smells lint is made to catch illegal code and therefore caught by the compiler. Stewart. |
April 26, 2012 Re: Docs: Section on local variables | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Thursday, April 26, 2012 23:52:48 bearophile wrote:
> Jonathan M Davis:
> > I don't even know the last time that I saw an unused
> > variable left in code (except for on purpose in something like
> > isInputRange).
>
> So if the compiler warns you of unused variables, this will not cause your code almost no warnings. No troubles for you. For uncommon situations like isInputRange a specific annotation solves the problem cleanly.
And I'd argue that we might as well save ourselves the trouble of having to deal with yet _another_ special annotation just so that we can have warnings about something which is generally a non-issue.
- Jonathan M Davis
|
Copyright © 1999-2021 by the D Language Foundation