Generic memory allocation in D

kdevel kdevel at vogtner.de
Mon Mar 4 22:57:51 UTC 2024


On Monday, 4 March 2024 at 20:38:05 UTC, Paul Backus wrote:
> 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))

"Safe 'check' for chess" [1]

>         // 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

And yesterday I found a post where an "is" function does not 
return
a bool [2]:

https://github.com/dlang/dmd/pull/16280/files
package CppOperator isCppOperator(const scope Identifier id)


[1] https://jhall.io/archive/2021/09/29/save-check-for-chess/
[2] https://forum.dlang.org/post/us0248$1ttt$1@digitalmars.com


More information about the Digitalmars-d mailing list