Generic memory allocation in D

Paul Backus snarwin at gmail.com
Mon Mar 4 20:38:05 UTC 2024


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


More information about the Digitalmars-d mailing list