How purity w/o the specific optimizations then allowed is useful ?

Dom DiSc dominikus at scherkl.de
Wed Apr 17 07:59:01 UTC 2024


On Tuesday, 16 April 2024 at 15:07:34 UTC, Basile B. wrote:

> How is purity a useful concept if not leading to specific 
> optimizations ?
>
> And is that even the case ?

For me, the main purpose of pure is to distinguish if a statement 
like

```d
foo();
```

is valid code or not.
For a pure function this is a bug, as it has no (side)effect. For 
a non-pure function it may be valid even if the return type is 
not void.


More information about the Digitalmars-d mailing list