Re: Detector for unused variables

2012-08-01 Thread bearophile
Timon Gehr: No. This mustn't be part of the language. http://d.puremagic.com/issues/show_bug.cgi?id=7989 I agree there are some problems. But not putting this warning in the default language means such problems will not be faced at the language level itself too. So maybe no good solutions w

Re: Detector for unused variables

2012-08-01 Thread Jonathan M Davis
On Wednesday, August 01, 2012 17:07:31 Timon Gehr wrote: > On 08/01/2012 12:38 PM, bearophile wrote: > > Regan Heath: > >> Indeed. IIRC Walter's rationale on things like this has always been > >> that they belong in 3rd party tools. > > > > Walter is not always right. > > > >> It's why the DMD fr

Re: Detector for unused variables

2012-08-01 Thread Regan Heath
On Wed, 01 Aug 2012 15:52:22 +0100, bearophile wrote: Regan Heath: If you make detecting un-used variables a /requirement/ for implementing a D compiler, you make it that much less likely someone will write one, Detecting unused variables can be written as a part of the front-end. Or i

Re: Detector for unused variables

2012-08-01 Thread Timon Gehr
On 08/01/2012 12:38 PM, bearophile wrote: Regan Heath: Indeed. IIRC Walter's rationale on things like this has always been that they belong in 3rd party tools. Walter is not always right. It's why the DMD front end is available for use, so people can create tools like this, syntax highligh

Re: Detector for unused variables

2012-08-01 Thread bearophile
Regan Heath: If you make detecting un-used variables a /requirement/ for implementing a D compiler, you make it that much less likely someone will write one, Detecting unused variables can be written as a part of the front-end. It's meant to be shared by LDC and GDC that use the same front-

Re: Detector for unused variables

2012-08-01 Thread Regan Heath
On Wed, 01 Aug 2012 12:03:01 +0100, Andre Tampubolon wrote: The Go compiler is able to detect unused variables, and strangely they are regarded as an error. It's not really a question of "able" to, or not. I'm sure were Walter to decide to add this feature to D he would also be "able" t

Re: Detector for unused variables

2012-08-01 Thread Andre Tampubolon
The Go compiler is able to detect unused variables, and strangely they are regarded as an error. On 8/1/2012 5:38 PM, bearophile wrote: Detecting unused variables is a core feature, it belongs in the compiler, like compile-time array bound tests and other errors currently detected by DMD. This

Re: Detector for unused variables

2012-08-01 Thread Regan Heath
On Wed, 01 Aug 2012 11:38:46 +0100, bearophile wrote: Regan Heath: Indeed. IIRC Walter's rationale on things like this has always been that they belong in 3rd party tools. Walter is not always right. Well, in this case I agree with him. You're not looking at the big picture. If yo

Re: Detector for unused variables

2012-08-01 Thread bearophile
Regan Heath: Indeed. IIRC Walter's rationale on things like this has always been that they belong in 3rd party tools. Walter is not always right. It's why the DMD front end is available for use, so people can create tools like this, syntax highlighters, re-formatters, dependency tree diag

Re: Detector for unused variables

2012-08-01 Thread Regan Heath
On Mon, 30 Jul 2012 18:41:51 +0100, Jonathan M Davis wrote: On Monday, July 30, 2012 18:50:08 Andrej Mitrovic wrote: On 7/30/12, Namespace wrote: > IMO something like this should be integrated into the D compiler. As long as it's togglable via a compiler switch. :) Walter doesn't like co

Re: Detector for unused variables

2012-07-31 Thread Timon Gehr
On 07/31/2012 11:55 AM, Minas wrote: I agree that having the compiler make warnings about unused variables is a really good idea!!! Java has it and when I program in eclipse it's really useful because the editor can highlight the particular lines. An editor can be configured to point it out ev

Re: Detector for unused variables

2012-07-31 Thread Minas
I agree that having the compiler make warnings about unused variables is a really good idea!!! Java has it and when I program in eclipse it's really useful because the editor can highlight the particular lines.

Re: Detector for unused variables

2012-07-30 Thread bearophile
Dmitry Olshansky: I'm seeing the same argument over and over again :) most D programmers. What do you look for? A language designed for 5-10% of its users? No thanks. Bye, bearophile

Re: Detector for unused variables

2012-07-30 Thread Dmitry Olshansky
On 31-Jul-12 02:02, bearophile wrote: Dmitry Olshansky: "Most people I know" is hardly good enough argument. The point is that this warning is a basic thing, other compilers have it and I enjoy it in those languages and putting this feature into external tools is not going to help I'm seein

Re: Detector for unused variables

2012-07-30 Thread bearophile
Dmitry Olshansky: "Most people I know" is hardly good enough argument. The point is that this warning is a basic thing, other compilers have it and I enjoy it in those languages and putting this feature into external tools is not going to help most D programmers. I know but DMD won't ha

Re: Detector for unused variables

2012-07-30 Thread Dmitry Olshansky
On 31-Jul-12 01:37, bearophile wrote: Jonathan M Davis: This is the sort of thing that's better left to a lint-like tool IMHO. Putting it in a lint means people have to know what a lint is, desire to search it, install, and add its running to their compilation ways. Just run it once on each

Re: Detector for unused variables

2012-07-30 Thread bearophile
Jonathan M Davis: This is the sort of thing that's better left to a lint-like tool IMHO. Putting it in a lint means people have to know what a lint is, desire to search it, install, and add its running to their compilation ways. It also means the lint needs to contain part of a D compiler.

Re: Detector for unused variables

2012-07-30 Thread Namespace
On Monday, 30 July 2012 at 21:13:42 UTC, Andrej Mitrovic wrote: On 7/30/12, Namespace wrote: BTW: Has anyone test my detector and could give me some suggestions or critism? I've tried it out and it didn't find any unused variables, but I doubt this is true, I'm not very tidy when it comes t

Re: Detector for unused variables

2012-07-30 Thread Andrej Mitrovic
On 7/30/12, Namespace wrote: > BTW: Has anyone test my detector and could give me some > suggestions or critism? > I've tried it out and it didn't find any unused variables, but I doubt this is true, I'm not very tidy when it comes to using variables. I do use a lot of templates so maybe the scri

Re: Detector for unused variables

2012-07-30 Thread Dmitry Olshansky
On 31-Jul-12 00:45, Namespace wrote: On Monday, 30 July 2012 at 20:06:42 UTC, Dmitry Olshansky wrote: On 31-Jul-12 00:02, Namespace wrote: BTW: Has anyone test my detector and could give me some suggestions or critism? I haven't tested it but offhand I call it inaccurate :) I had only cursory

Re: Detector for unused variables

2012-07-30 Thread Namespace
On Monday, 30 July 2012 at 20:06:42 UTC, Dmitry Olshansky wrote: On 31-Jul-12 00:02, Namespace wrote: BTW: Has anyone test my detector and could give me some suggestions or critism? I haven't tested it but offhand I call it inaccurate :) I had only cursory look at it but: regexes are way unde

Re: Detector for unused variables

2012-07-30 Thread Ali Çehreli
On 07/30/2012 12:02 PM, Namespace wrote: > there is no reason which stands against a warning for unused variables. > Or can you tell me some personal reasons, without quoting Walter? People comment-out parts of code during development and debugging, leaving unused variables behind (just for a w

Re: Detector for unused variables

2012-07-30 Thread Jonathan M Davis
On Monday, July 30, 2012 21:02:14 Namespace wrote: > That's right. But the majority of programming languages has this > feature, but D does not. This feature is undeniable effective, so > IMO there is no reason which stands against a warning for unused > variables. Or can you tell me some personal

Re: Detector for unused variables

2012-07-30 Thread Dmitry Olshansky
On 31-Jul-12 00:02, Namespace wrote: BTW: Has anyone test my detector and could give me some suggestions or critism? I haven't tested it but offhand I call it inaccurate :) I had only cursory look at it but: regexes are way underpowered to do the task and thus false positives and false negativ

Re: Detector for unused variables

2012-07-30 Thread Namespace
BTW: Has anyone test my detector and could give me some suggestions or critism?

Re: Detector for unused variables

2012-07-30 Thread Namespace
Plenty of the community agrees with him too, much as there may be some vocal folks who don't. Regardless, because he's the gatekeeper of the reference compiler, he has to be convinced if you want a feature added to either the language or the compiler. He's generally quite reasonable, but he als

Re: Detector for unused variables

2012-07-30 Thread Jonathan M Davis
On Monday, July 30, 2012 20:39:02 Namespace wrote: > Jonathan M Davis: > Walter hates so much things, nearly all what the community wishes > for: not null types, warnings for unused variables, warnings for > unused imports and so on. > It does not only count what he wants but what is useful, IMO.

Re: Detector for unused variables

2012-07-30 Thread Namespace
On Monday, 30 July 2012 at 17:39:31 UTC, bearophile wrote: Namespace: I suggest to attach both code and testcases to: http://d.puremagic.com/issues/show_bug.cgi?id=3960 Done. I see no attachments :-( Only ephemeral links. Bye, bearophile Sorry, but i can upload only one file. I will uplo

Re: Detector for unused variables

2012-07-30 Thread Jonathan M Davis
On Monday, July 30, 2012 20:08:12 Andrej Mitrovic wrote: > On 7/30/12, Jonathan M Davis wrote: > > Walter doesn't like compiler switches like that > > Walter is a big fat phony, count the number of switches here: > http://www.digitalmars.com/ctg/sc.html#switches That may be part of _why_ he does

Re: Detector for unused variables

2012-07-30 Thread Andrej Mitrovic
On 7/30/12, Jonathan M Davis wrote: > Walter doesn't like compiler switches like that Walter is a big fat phony, count the number of switches here: http://www.digitalmars.com/ctg/sc.html#switches :D

Re: Detector for unused variables

2012-07-30 Thread Jonathan M Davis
On Monday, July 30, 2012 18:50:08 Andrej Mitrovic wrote: > On 7/30/12, Namespace wrote: > > IMO something like this should be integrated into the D compiler. > > As long as it's togglable via a compiler switch. :) Walter doesn't like compiler switches like that, and he doesn't like it when the

Re: Detector for unused variables

2012-07-30 Thread bearophile
Namespace: I suggest to attach both code and testcases to: http://d.puremagic.com/issues/show_bug.cgi?id=3960 Done. I see no attachments :-( Only ephemeral links. Bye, bearophile

Re: Detector for unused variables

2012-07-30 Thread Namespace
I suggest to attach both code and testcases to: http://d.puremagic.com/issues/show_bug.cgi?id=3960 Done.

Re: Detector for unused variables

2012-07-30 Thread bearophile
Namespace: I think my english isn't good enough to make a persuasive comment there, but i will try it this evening. I will simply copy my post above. Your English skills seems enough, but in the end what's important is to show that some people care to have for this warning. Walter is usually

Re: Detector for unused variables

2012-07-30 Thread Namespace
On Monday, 30 July 2012 at 16:47:32 UTC, bearophile wrote: Namespace: I wrote a short programm which detect and list unused variables. I suggest to attach both code and testcases to: http://d.puremagic.com/issues/show_bug.cgi?id=3960 Even if your code will never be used, it shows Walter&Andre

Re: Detector for unused variables

2012-07-30 Thread Andrej Mitrovic
On 7/30/12, Namespace wrote: > IMO something like this should be integrated into the D compiler. As long as it's togglable via a compiler switch. :)

Re: Detector for unused variables

2012-07-30 Thread bearophile
Namespace: I wrote a short programm which detect and list unused variables. I suggest to attach both code and testcases to: http://d.puremagic.com/issues/show_bug.cgi?id=3960 Even if your code will never be used, it shows Walter&Andrei that there is interest in having this warning, and test c

Detector for unused variables

2012-07-30 Thread Namespace
I wrote a short programm which detect and list unused variables. I'm sure it isn't perfect but it passed most of my test cases, but I think at the moment it isn't good enough to present it in announce. Maybe some of you have interest to help me. IMO something like this should be integrated into