Shadowing of members

comco void.unsigned at gmail.com
Thu Jan 10 02:38:37 PST 2013


On Thursday, 10 January 2013 at 10:18:38 UTC, Benjamin Thaut 
wrote:
> Am 10.01.2013 09:37, schrieb comco:
>> There is a rationale for such checks, but I argue that the 
>> place of
>> these checks is not in the compiler itself, but in a separate 
>> tool.
>
> But there are no such tools yet for D.
> Couldn't we add a -analyze flag to the compiler which will do 
> such checks? Other compilers like the microsoft c++ compiler 
> provide such a flag too.

A simple flag just won't cut it, because the state that you want 
to represent is wider. Some rules are speculative in nature, 
others can be easily broken if you are using some sort of 
automatic code generation - for example image a GUI forms visual 
editor which emits D code. It won't be smart enough to follow all 
the guidelines of the language, still the emitted source code 
should be considered fine. You at least will need something like 
a level or target flag - for me assembly code when writing high 
level code is unacceptable, but for low-level stuff its a must. 
So you'll need a separate specification of the kind of analyzing 
you want for the particular code. You'll want some of the rules 
to be turned off.
Another thing is that if the effort to create such tool is 
comparable to the effort of adding an analyze flag to the already 
existing compiler, then in my opinion creating a tool would be 
the better option - its more nice and separated this way.


More information about the Digitalmars-d mailing list