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 reasons, without > quoting Walter?
Aside from the fact that it can be really annoying when the compiler complains about unused parameters? I believe that the bug report that you posted to includes some discussion on some of the technical issues caused by making unused variables a warning. In particular, it causes problems for generic code as well as template constraints. A _lot_ of templates used for template constraints would generate warnings if usused variables were a warning. So, if you were compiling with -w, it would become _very_ easy to have your program not compile. And there are plenty of cases where generated code ends up with unused variables, and it's fine. I grant you that it's undesirable to have unused variables sitting around in most functions, but there _are_ cases where disallowing that (as making it a warning effectively does) causes problems. This is the sort of thing that's better left to a lint-like tool IMHO. - Jonathan M Davis