digitalmars.D - [DIP1005] Unused imports in with(import) declarations: leave alone of
- Andrei Alexandrescu (11/11) Dec 24 2016 Consider:
- Tourist (7/18) Dec 24 2016 I'd use a warning, as with unused variables: the code is in an OK
- rikki cattermole (2/13) Dec 24 2016 How costly is the checking of if said import is used?
- Jonathan M Davis via Digitalmars-d (7/17) Dec 24 2016 I say leave it be. It's the sort of thing that risks causing problems wi...
- ketmar (4/7) Dec 24 2016 please, no. "this is a work for a linter", as Walter likes to say
- John Colvin (4/15) Dec 25 2016 Generic code and generated code would suffer from an error being
- Daniel =?iso-8859-1?b?S2964Ws=?= via Digitalmars-d (4/19) Dec 25 2016 for such things there should be support in IDE or use some lint tool
Consider: with (import std.stdio) int fun(int x/*, File f*/) { // f.writeln("In: ", x); return x * x; } Such situations occur during refactorings and code evolution. The import is no longer used. Should the compiler flag that as an error, or leave it be? Andrei
Dec 24 2016
On Saturday, 24 December 2016 at 20:32:58 UTC, Andrei Alexandrescu wrote:Consider: with (import std.stdio) int fun(int x/*, File f*/) { // f.writeln("In: ", x); return x * x; } Such situations occur during refactorings and code evolution. The import is no longer used. Should the compiler flag that as an error, or leave it be? AndreiI'd use a warning, as with unused variables: the code is in an OK state when in the middle of a work (such as temporarily commenting a block), but less OK for a release. nice.
Dec 24 2016
On 25/12/2016 9:32 AM, Andrei Alexandrescu wrote:Consider: with (import std.stdio) int fun(int x/*, File f*/) { // f.writeln("In: ", x); return x * x; } Such situations occur during refactorings and code evolution. The import is no longer used. Should the compiler flag that as an error, or leave it be? AndreiHow costly is the checking of if said import is used?
Dec 24 2016
On Saturday, December 24, 2016 15:32:58 Andrei Alexandrescu via Digitalmars- d wrote:Consider: with (import std.stdio) int fun(int x/*, File f*/) { // f.writeln("In: ", x); return x * x; } Such situations occur during refactorings and code evolution. The import is no longer used. Should the compiler flag that as an error, or leave it be?I say leave it be. It's the sort of thing that risks causing problems with conditional compilation (not as bad as in some cases, but I still don't think that it's worth the risk). IMHO, this is the sort of thing that should be left up to a lint tool, and there's technically nothing wrong with it. - Jonathan M Davis
Dec 24 2016
On Saturday, 24 December 2016 at 20:32:58 UTC, Andrei Alexandrescu wrote:Such situations occur during refactorings and code evolution. The import is no longer used. Should the compiler flag that as an error, or leave it be?please, no. "this is a work for a linter", as Walter likes to say (sorry for inexact quoting ;-).
Dec 24 2016
On Saturday, 24 December 2016 at 20:32:58 UTC, Andrei Alexandrescu wrote:Consider: with (import std.stdio) int fun(int x/*, File f*/) { // f.writeln("In: ", x); return x * x; } Such situations occur during refactorings and code evolution. The import is no longer used. Should the compiler flag that as an error, or leave it be? AndreiGeneric code and generated code would suffer from an error being generated there.
Dec 25 2016
Andrei Alexandrescu via Digitalmars-d <digitalmars-d puremagic.com>=20 napsal So, pro 24, 2016 v 9=E2=88=B632 :Consider: =20 with (import std.stdio) int fun(int x/*, File f*/) { // f.writeln("In: ", x); return x * x; } =20 Such situations occur during refactorings and code evolution. The=20 import is no longer used. Should the compiler flag that as an error,=20 or leave it be? =20 =20 Andreifor such things there should be support in IDE or use some lint tool =
Dec 25 2016