Re: Warn on unused imports?

2018-10-05 Thread JN via Digitalmars-d
On Wednesday, 3 October 2018 at 17:33:43 UTC, Dennis wrote: Sure, the Unix way is a nice philosophy, but let's face the facts: - Because of (amongst others) CTFE and mixin, D is an incredibly complicated language to reason about (unlike Java or C#) - There is only one D front-end, and it will

Re: Warn on unused imports?

2018-10-05 Thread Patrick Schluter via Digitalmars-d
On Thursday, 4 October 2018 at 18:55:01 UTC, Nick Sabalausky (Abscissa) wrote: On 09/26/2018 06:00 AM, Anonymouse wrote: On Tuesday, 25 September 2018 at 13:03:30 UTC, FeepingCreature wrote: I'm playing with a branch of DMD that would warn on unused imports: Would just like to say that I

Re: Warn on unused imports?

2018-10-04 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 09/26/2018 06:00 AM, Anonymouse wrote: On Tuesday, 25 September 2018 at 13:03:30 UTC, FeepingCreature wrote: I'm playing with a branch of DMD that would warn on unused imports: Would just like to say that I love the idea and would use it immediately. Same here. Periodically, my import

Re: Warn on unused imports?

2018-10-03 Thread Dennis via Digitalmars-d
On Wednesday, 3 October 2018 at 14:27:42 UTC, Dejan Lekic wrote: IDK, I prefer things done in the UNIX way - do one thing and do it right. Compiler should do what its name says - COMPILE, while some other tool should be made for these kind of code checks. The code will compile no matter

Re: Warn on unused imports?

2018-10-03 Thread Dejan Lekic via Digitalmars-d
On Thursday, 27 September 2018 at 18:35:58 UTC, Nick Sabalausky (Abscissa) wrote: On 09/26/2018 04:37 AM, Dejan Lekic wrote: On Tuesday, 25 September 2018 at 13:03:30 UTC, FeepingCreature wrote: I'm playing with a branch of DMD that would warn on unused imports: I humbly believe this does

Re: Warn on unused imports?

2018-10-02 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 10/01/2018 11:00 PM, Jonathan M Davis wrote: The very fact that we have -w causes problems, because it forks the language. e.g. anyone that doesn't compile a library with -wi or -w and then releases it with dub can cause problems when someone else uses that project and then _does_ compile

Re: Warn on unused imports?

2018-10-01 Thread Jonathan M Davis via Digitalmars-d
On Monday, October 1, 2018 8:03:39 PM MDT Nick Sabalausky (Abscissa) via Digitalmars-d wrote: > On 10/01/2018 04:58 PM, Jonathan M Davis wrote: > > On Monday, October 1, 2018 2:44:32 PM MDT Nick Sabalausky (Abscissa) via > > > > Digitalmars-d wrote: > >> Nobody said anything about making them

Re: Warn on unused imports?

2018-10-01 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 10/01/2018 04:58 PM, Jonathan M Davis wrote: On Monday, October 1, 2018 2:44:32 PM MDT Nick Sabalausky (Abscissa) via Digitalmars-d wrote: Nobody said anything about making them part of the build process. We're talking about them being included in the compiler, not about them being in the

Re: Warn on unused imports?

2018-10-01 Thread Jonathan M Davis via Digitalmars-d
On Monday, October 1, 2018 2:44:32 PM MDT Nick Sabalausky (Abscissa) via Digitalmars-d wrote: > On 10/01/2018 03:32 PM, Jonathan M Davis wrote: > > On Monday, October 1, 2018 12:36:49 PM MDT Nick Sabalausky (Abscissa) > > via > > > > Digitalmars-d wrote: > >> Yes, that's exactly what warnings are

Re: Warn on unused imports?

2018-10-01 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 10/01/2018 03:32 PM, Jonathan M Davis wrote: On Monday, October 1, 2018 12:36:49 PM MDT Nick Sabalausky (Abscissa) via Digitalmars-d wrote: Yes, that's exactly what warnings are for. If people need to treat them differently than that (ex: C++), that's a failing of the language. As soon as

Re: Warn on unused imports?

2018-10-01 Thread Jonathan M Davis via Digitalmars-d
On Monday, October 1, 2018 12:36:49 PM MDT Nick Sabalausky (Abscissa) via Digitalmars-d wrote: > On 09/25/2018 09:13 PM, Jonathan M Davis wrote: > > IMHO, the only time that anything along the lines of a warning > > makes sense is when the programmer is proactively running a tool to > >

Re: Warn on unused imports?

2018-10-01 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 09/25/2018 09:13 PM, Jonathan M Davis wrote: IMHO, the only time that anything along the lines of a warning makes sense is when the programmer is proactively running a tool to specifically ask to be informed of a potential type of problem where they will then go look at each of them

Re: Warn on unused imports?

2018-09-30 Thread FeepingCreature via Digitalmars-d
On Wednesday, 26 September 2018 at 16:29:24 UTC, Neia Neutuladh wrote: * If you encounter a mixin in the module you're analyzing, give up. Unfortunately, our code uses mixins heavily, so I don't think this would be useful for us. In any case, I fundamentally don't consider the approach of

Re: Warn on unused imports?

2018-09-28 Thread Jonathan M Davis via Digitalmars-d
On Friday, September 28, 2018 6:50:01 AM MDT Olivier FAURE via Digitalmars-d wrote: > Warnings often catch real problems, even categories of warnings > with high amounts of false positives like unused variables. > > But yeah, I get your point. Warning lose their interest when they > start to pile

Re: Warn on unused imports?

2018-09-28 Thread Olivier FAURE via Digitalmars-d
On Wednesday, 26 September 2018 at 09:25:11 UTC, Jonathan M Davis wrote: It's just a message. You can use a compiler flag to make the message go away or to turn it into an error (though in general, I'd advise against it, since then your code breaks as soon as something gets deprecated), but by

Re: Warn on unused imports?

2018-09-28 Thread Jacob Carlborg via Digitalmars-d
On Wednesday, 26 September 2018 at 15:57:57 UTC, rikki cattermole wrote: For those who are unaware, dmd-fe for usage as a library is completely worthless currently. So not having the tags is probably a good thing. For those who are unaware I'm using it in one of my projects [1] and so far

Re: Warn on unused imports?

2018-09-27 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 09/26/2018 04:37 AM, Dejan Lekic wrote: On Tuesday, 25 September 2018 at 13:03:30 UTC, FeepingCreature wrote: I'm playing with a branch of DMD that would warn on unused imports: I humbly believe this does not belong to the compiler. These sort of things belong to a static code analyser

Re: Warn on unused imports?

2018-09-26 Thread Neia Neutuladh via Digitalmars-d
On 09/26/2018 02:51 AM, FeepingCreature wrote: On Wednesday, 26 September 2018 at 08:37:12 UTC, Dejan Lekic wrote: I humbly believe this does not belong to the compiler. These sort of things belong to a static code analyser TOOL. Think of checkstyle/findbugs in Java, or flake8/pep8 in Python

Re: Warn on unused imports?

2018-09-26 Thread rikki cattermole via Digitalmars-d
On 27/09/2018 3:53 AM, Neia Neutuladh wrote: On 09/26/2018 12:39 AM, FeepingCreature wrote: On Tuesday, 25 September 2018 at 19:28:47 UTC, Jacob Carlborg wrote: The DMD compiler is available as a library. A linter tool can be based on that. Repeating it here: the library does not have

Re: Warn on unused imports?

2018-09-26 Thread Neia Neutuladh via Digitalmars-d
On 09/26/2018 12:39 AM, FeepingCreature wrote: On Tuesday, 25 September 2018 at 19:28:47 UTC, Jacob Carlborg wrote: The DMD compiler is available as a library. A linter tool can be based on that. Repeating it here: the library does not have version-tagged releases. For a build system based

Re: Warn on unused imports?

2018-09-26 Thread drug via Digitalmars-d
26.09.2018 13:00, Anonymouse пишет: On Tuesday, 25 September 2018 at 13:03:30 UTC, FeepingCreature wrote: I'm playing with a branch of DMD that would warn on unused imports: Would just like to say that I love the idea and would use it immediately. Currently going through old code

Re: Warn on unused imports?

2018-09-26 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, September 26, 2018 4:46:23 AM MDT Laurent Tréguier via Digitalmars-d wrote: > From dmd's help: > ``` >-dsilently allow deprecated features >-dw show use of deprecated features as warnings > (default) >-de show use of

Re: Warn on unused imports?

2018-09-26 Thread Laurent Tréguier via Digitalmars-d
On Wednesday, 26 September 2018 at 09:25:11 UTC, Jonathan M Davis wrote: IMHO, the way that dmd currently handles deprecations works quite well overall. It simply prints a message. It's not a warning, and it's not an error. It's just a message. You can use a compiler flag to make the message

Re: Warn on unused imports?

2018-09-26 Thread Dennis via Digitalmars-d
On Tuesday, 25 September 2018 at 13:03:30 UTC, FeepingCreature wrote: I'm playing with a branch of DMD that would warn on unused imports: Cool that you're working on this!

Re: Warn on unused imports?

2018-09-26 Thread Anonymouse via Digitalmars-d
On Tuesday, 25 September 2018 at 13:03:30 UTC, FeepingCreature wrote: I'm playing with a branch of DMD that would warn on unused imports: Would just like to say that I love the idea and would use it immediately. Currently going through old code that evolved too organically, with imports too

Re: Warn on unused imports?

2018-09-26 Thread FeepingCreature via Digitalmars-d
On Wednesday, 26 September 2018 at 08:37:12 UTC, Dejan Lekic wrote: I humbly believe this does not belong to the compiler. These sort of things belong to a static code analyser TOOL. Think of checkstyle/findbugs in Java, or flake8/pep8 in Python world. I can't put it differently than this:

Re: Warn on unused imports?

2018-09-26 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, September 26, 2018 2:26:20 AM MDT Laurent Tréguier via Digitalmars-d wrote: > On Wednesday, 26 September 2018 at 01:13:11 UTC, Jonathan M Davis > > wrote: > > The way that C++ handles warnings is how I've seen most > > languages handle warnings. IMHO, the only time that anything > >

Re: Warn on unused imports?

2018-09-26 Thread Dominikus Dittes Scherkl via Digitalmars-d
On Tuesday, 25 September 2018 at 14:28:48 UTC, FeepingCreature wrote: On Tuesday, 25 September 2018 at 14:15:32 UTC, Dominikus Dittes Scherkl wrote: template from(string moduleName) { mixin("import from = " ~ moduleName ~ ";"); } class TestException(T) : from!"std.format".FormatException?

Re: Warn on unused imports?

2018-09-26 Thread Dejan Lekic via Digitalmars-d
On Tuesday, 25 September 2018 at 13:03:30 UTC, FeepingCreature wrote: I'm playing with a branch of DMD that would warn on unused imports: I humbly believe this does not belong to the compiler. These sort of things belong to a static code analyser TOOL. Think of checkstyle/findbugs in Java

Re: Warn on unused imports?

2018-09-26 Thread Laurent Tréguier via Digitalmars-d
On Wednesday, 26 September 2018 at 01:13:11 UTC, Jonathan M Davis wrote: The way that C++ handles warnings is how I've seen most languages handle warnings. IMHO, the only time that anything along the lines of a warning makes sense is when the programmer is proactively running a tool to

Re: Warn on unused imports?

2018-09-26 Thread FeepingCreature via Digitalmars-d
On Wednesday, 26 September 2018 at 01:13:11 UTC, Jonathan M Davis wrote: IMHO, the only time that anything along the lines of a warning makes sense is when the programmer is proactively running a tool to specifically ask to be informed of a potential type of problem where they will then go

Re: Warn on unused imports?

2018-09-26 Thread FeepingCreature via Digitalmars-d
On Tuesday, 25 September 2018 at 19:28:47 UTC, Jacob Carlborg wrote: The DMD compiler is available as a library. A linter tool can be based on that. Repeating it here: the library does not have version-tagged releases. For a build system based around reproducible builds, this makes it

Re: Warn on unused imports?

2018-09-25 Thread Jonathan M Davis via Digitalmars-d
ith a branch of DMD that would warn on unused > >> imports: > >> > >> https://github.com/FeepingCreature/dmd/tree/feature/Issue-3507-warn-on-> > >> >> unu sed-imports > >> > >> Two problems have arisen. > >> > >>

Re: Warn on unused imports?

2018-09-25 Thread Jacob Carlborg via Digitalmars-d
On 2018-09-25 16:20, FeepingCreature wrote: If that's the way D wanted to go, it shouldn't have turned itself into a metaprogramming monster that's completely unevaluable by Linter tools, *or* it should offer some way to dump a fixed-format lowered representation with line number information

Re: Warn on unused imports?

2018-09-25 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 09/25/2018 09:14 AM, Jonathan M Davis wrote: On Tuesday, September 25, 2018 7:03:30 AM MDT FeepingCreature via Digitalmars-d wrote: I'm playing with a branch of DMD that would warn on unused imports: https://github.com/FeepingCreature/dmd/tree/feature/Issue-3507-warn-on-unu sed-imports Two

Re: Warn on unused imports?

2018-09-25 Thread FeepingCreature via Digitalmars-d
On Tuesday, 25 September 2018 at 14:15:32 UTC, Dominikus Dittes Scherkl wrote: On Tuesday, 25 September 2018 at 13:03:30 UTC, FeepingCreature wrote: I'm playing with a branch of DMD that would warn on unused imports: https://github.com/FeepingCreature/dmd/tree/feature/Issue-3507-warn

Re: Warn on unused imports?

2018-09-25 Thread FeepingCreature via Digitalmars-d
On Tuesday, 25 September 2018 at 13:14:36 UTC, Jonathan M Davis wrote: If something is definitively wrong, then it should be an error. If it's not definitively wrong, then the compiler shouldn't say anything about it, and it should be left up to a linter tool of some kind like dcd. -

Re: Warn on unused imports?

2018-09-25 Thread Dominikus Dittes Scherkl via Digitalmars-d
On Tuesday, 25 September 2018 at 13:03:30 UTC, FeepingCreature wrote: I'm playing with a branch of DMD that would warn on unused imports: https://github.com/FeepingCreature/dmd/tree/feature/Issue-3507-warn-on-unused-imports Two problems have arisen. First: import std.stdio; void foo(T

Re: Warn on unused imports?

2018-09-25 Thread Gary Willoughby via Digitalmars-d
On Tuesday, 25 September 2018 at 13:03:30 UTC, FeepingCreature wrote: I'm playing with a branch of DMD that would warn on unused imports: Honestly, I hate these types of warnings/errors. It makes playing with and designing code such a chore. I hope this is opt-in.

Re: Warn on unused imports?

2018-09-25 Thread Jonathan M Davis via Digitalmars-d
On Tuesday, September 25, 2018 7:03:30 AM MDT FeepingCreature via Digitalmars-d wrote: > I'm playing with a branch of DMD that would warn on unused > imports: > > https://github.com/FeepingCreature/dmd/tree/feature/Issue-3507-warn-on-unu > sed-imports > > Two problems h

Re: Warn on unused imports?

2018-09-25 Thread FeepingCreature via Digitalmars-d
On Tuesday, 25 September 2018 at 13:03:30 UTC, FeepingCreature wrote: I'm playing with a branch of DMD that would warn on unused imports: [...] For instance, I've been thinking about hiding the warning behind an additional flag (-wunused-imports or -wu?) so that it's opt-in. Would

Warn on unused imports?

2018-09-25 Thread FeepingCreature via Digitalmars-d
I'm playing with a branch of DMD that would warn on unused imports: https://github.com/FeepingCreature/dmd/tree/feature/Issue-3507-warn-on-unused-imports Two problems have arisen. First: import std.stdio; void foo(T)() { writeln("Hello World"); } foo.d: Warning: unused import

Re: How to warn of unused imports?

2016-02-09 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 9 February 2016 at 17:54:30 UTC, Basile B. wrote: On Tuesday, 9 February 2016 at 15:21:59 UTC, Basile B. wrote: On Monday, 8 February 2016 at 20:48:29 UTC, cy wrote: On Monday, 8 February 2016 at 18:57:52 UTC, Basile B. wrote: Otherwise, it sounds like a decent enhancement request

Re: How to warn of unused imports?

2016-02-09 Thread Basile B. via Digitalmars-d-learn
On Monday, 8 February 2016 at 20:48:29 UTC, cy wrote: On Monday, 8 February 2016 at 18:57:52 UTC, Basile B. wrote: Otherwise, it sounds like a decent enhancement request for DMD. I know other compilers who do this warning. It definitely does sound like a decent enhancement request. I didn't

Re: How to warn of unused imports?

2016-02-09 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 9 February 2016 at 15:21:59 UTC, Basile B. wrote: On Monday, 8 February 2016 at 20:48:29 UTC, cy wrote: On Monday, 8 February 2016 at 18:57:52 UTC, Basile B. wrote: Otherwise, it sounds like a decent enhancement request for DMD. I know other compilers who do this warning. It

Re: How to warn of unused imports?

2016-02-08 Thread Daniel Kozak via Digitalmars-d-learn
V Mon, 08 Feb 2016 08:25:09 + cy via Digitalmars-d-learn napsáno: > When I factor out code from my modules, it really, really often > leaves import statements that just sit there doing nothing, > making it look like my program is more complex than it is.

How to warn of unused imports?

2016-02-08 Thread cy via Digitalmars-d-learn
When I factor out code from my modules, it really, really often leaves import statements that just sit there doing nothing, making it look like my program is more complex than it is. How do I get warned for leaving those, and a list of which ones I can safely remove?

Re: How to warn of unused imports?

2016-02-08 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 8 February 2016 at 08:25:09 UTC, cy wrote: How do I get warned for leaving those, and a list of which ones I can safely remove? Remove one, recompile. If it passes, leave it. If not, undo and move on to the next one.

Re: How to warn of unused imports?

2016-02-08 Thread Ali Çehreli via Digitalmars-d-learn
On 02/08/2016 06:35 AM, Adam D. Ruppe wrote: On Monday, 8 February 2016 at 08:25:09 UTC, cy wrote: How do I get warned for leaving those, and a list of which ones I can safely remove? Remove one, recompile. If it passes, leave it. If not, undo and move on to the next one. Similarly, I

Re: How to warn of unused imports?

2016-02-08 Thread cy via Digitalmars-d-learn
On Monday, 8 February 2016 at 18:57:52 UTC, Basile B. wrote: Otherwise, it sounds like a decent enhancement request for DMD. I know other compilers who do this warning. It definitely does sound like a decent enhancement request. I didn't know it wasn't implemented yet, but it should be

Re: How to warn of unused imports?

2016-02-08 Thread Basile B. via Digitalmars-d-learn
On Monday, 8 February 2016 at 08:50:17 UTC, Daniel Kozak wrote: V Mon, 08 Feb 2016 08:25:09 + cy via Digitalmars-d-learn napsáno: When I factor out code from my modules, it really, really often leaves import statements that just sit there doing