Detect uninitialized class var access

Tejas notrealemail at gmail.com
Sun Sep 25 03:04:45 UTC 2022


On Saturday, 24 September 2022 at 23:04:00 UTC, rassoc wrote:
> On 9/24/22 15:28, Adam D Ruppe via Digitalmars-d-learn wrote:
>> gdb --args ./your_program
>> 
>> and then it will tell you all the details you want to know 
>> about when this happens.
>
> Thank you for your input, Adam.  Real shame that there's no 
> built-in compiler solution and probably never will be according 
> to [1]. :(
>
> D's competition got stuff like this right:
>
> ```
>> crystal build foo.cr
> In foo.cr:6:6
>
>  6 | puts f.x
>           ^
> Error: read before assignment to local variable 'f'
> ```
>
> [1] https://issues.dlang.org/show_bug.cgi?id=4595

AFAIK diagnostics like that are not possible because Walter 
doesn't want to implement full blown dataflow analysis in the 
compiler since it will slow down the compilation speed of dmd


More information about the Digitalmars-d-learn mailing list