GCC 4.6

Walter Bright newshound2 at digitalmars.com
Sat Oct 30 17:50:02 PDT 2010


Bearophile, let me start by emphasizing that you are a valuable member of the D 
community.

bearophile wrote:
> Walter:
> 
>> bearophile wrote:
>>>> The -Wshadow option now warns if a local variable or type declaration shadows another
>>>> type in C++. Note that the compiler will not warn if a local variable shadows a
>>>> struct/class/enum, but will warn if it shadows an explicit typedef.
>>> This seems interesting.
>> Yeah, D has had that for 10 years now.
> 
> Let's focus our attention on what DMD "lacks", instead! :-)

Why? What matters is whether D gets the job done or not, not whether it has a 
laundry list that encompasses every single feature of every other language. 
Isn't this endless desire for checklists of features incompatible with your 
expressed desire for a simple language? You post lists of features every day. If 
I had a staff of 100 expert people working on the compiler, I could not begin to 
keep up with that. At some point, it's pointless.

It also bothers me that you regularly read feature lists put out by other 
languages, and seem unaware of what D can do. For example, you wrote recently 
that dmd lacked data flow analysis optimizations.


> If you focus only on your strong points you will not improve yourself,

If you focus only on what you lack, you will be seriously unhappy. And D also 
*should* focus on what it does well.


> this is a basic rule for any serious artist or athlete.

Would you criticize a long distance runner for being lousy at wrestling? 
Shouldn't a long distance runner focus on what he's good at - long distance running?


> Regarding that feature, this program shows no warnings, is this a bad example?
> 
> alias int foo;
> struct bar {}
> void main() {
>     int foo;
>     int bar;
> }

Yes, it is a bad example. My experience is that shadowing global declarations is 
not a problem. Shadowing local ones is, though, and I've seen a lot of bugs 
caused by it.

void foo(int x)
{
   {
     long x;
   }
}

dmd -c test
test.d(4): Error: shadowing declaration test.foo.x is deprecated


More information about the Digitalmars-d mailing list