Generic memory allocation in D

Meta jared771 at gmail.com
Mon Mar 4 22:18:58 UTC 2024


On Monday, 4 March 2024 at 20:38:05 UTC, Paul Backus wrote:
> On Monday, 4 March 2024 at 09:53:17 UTC, Walter Bright wrote:
>> It means I don't have to use ! in:
>>
>>     if (foo())
>>     {
>>         error();
>>         return;
>>     }
>
> FWIW when I was new to the DMD codebase, I found it very 
> confusing to read this kind of code. And it doesn't help that 
> DMD is internally inconsistent about its use of bool.
>
> For example, you have this:
>
>     // true means success
>     if (f.isPure())
>         // it's pure
>     else
>         // it's impure
>
> ...but also this:
>
>     // true means failure
>     if (f.checkPurity(loc, sc))
>         // it's impure
>     else
>         // it's pure
>
> ...but also this:
>
>     // true means success
>     if (checkSymbolAccess(sc, sym))
>         // it's accessible
>     else
>         // it's not accessible
>
> ...but also this:
>
>     // true means failure
>     if (checkAccess(loc, sc, e, sym))
>         // it's not accessible
>     else
>         // it's accessible

Lol, if I were reviewing code that did this from one of my team 
members at work, their PR would definitely NOT be getting 
approved.


More information about the Digitalmars-d mailing list