Detector for unused variables

Dmitry Olshansky dmitry.olsh at gmail.com
Mon Jul 30 14:02:58 PDT 2012


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 look at it but: regexes are way underpowered to do
>> the task and thus false positives and false negatives are unavoidable.
>>
>> Just throw in more templates and mixins and it will fail ;)
>
> As i said: it isn't perfect yet. ;) But maybe one of you could help me.
> And regex are the only way i know to scan code.
> And yes i know, sometimes warnings for unused variables _would_ be
> annoying but then we have to discuss if a new compiler switch is useful.
> IMO it is, but IMO a shorthand like "?" for not null types is similar
> useful.

Adding new language features is at best problematic at this point.

> Maybe i expect to much, maybe i should use such programms only by myself.

I see no problem with a special D tool (a-la lint) that will check this 
and other possible problems.

-- 
Dmitry Olshansky


More information about the Digitalmars-d-learn mailing list