Simplification of @trusted
Timon Gehr
timon.gehr at gmx.ch
Wed Jun 23 12:39:03 UTC 2021
On 23.06.21 12:28, jmh530 wrote:
> On Wednesday, 23 June 2021 at 06:25:08 UTC, Andrei Alexandrescu wrote:
>> [snip]
>>> Doing things like that is why D supports @system code.
>>
>> Non-sequitur. The problem is there is no @system/@trusted/@safe troika
>> for pure. It's either pure or not, no way to express (as is needed in
>> key parts) "this function shall be trusted to be pure".
>> [snip]
>
> Reminds me of C's restrict. It's kind of like the equivalent of trusting
> that you are not overlapping data. I don't believe it provides a
> compile-time error if you do (just run-time undefined behavior).
UB is too blunt of an instrument for trusted pure though, you should
just lose some guarantees on ordering and number of executions, possibly
aliasing (due to memoization).
More information about the Digitalmars-d
mailing list