[SAoC2022] Replace libdparse with dmd-as-a-library in D-Scanner week 3

Lucian Danescu lucidanescu28 at yahoo.com
Mon Oct 10 18:31:07 UTC 2022


On Sunday, 9 October 2022 at 17:37:55 UTC, user1234 wrote:
> On Sunday, 9 October 2022 at 16:05:32 UTC, Lucian Danescu wrote:
>> Hello!
>>
>> [...]
>>
>> Let's consider this code
>>
>> ```
>> static class C
>> {
>>     // ...
>>     final void foo() { ... }
>>     // ...
>> }
>> ```
>>
>> So in D-Scanner we have a check that warns against redundant 
>> usage of `final` keyword.
>> `Final` is indeed redundant with static methods, but with the 
>> current D-Scanner implementation,
>> in the example above the usage of `final` is not signaled, 
>> while with my implementation it is.
>
> D-Scanner is right by no signaling anything.
>
> Without `final`, `foo` is virtual. The fact that `C` is static 
> just means that it cannot read in the parent frame, e.g if 
> declared inside a function body.

Ah then I made a confusion here, I thought of a static class like 
in Java for example, meaning all methods inside that class are 
static as well. If I understood right, this is not the case?


More information about the Digitalmars-d mailing list