Simplification of @trusted
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Wed Jun 23 06:25:08 UTC 2021
On 6/17/21 2:18 PM, Walter Bright wrote:
> On 6/17/2021 8:49 AM, Andrei Alexandrescu wrote:
>> I think the whole discussion should be redirected toward simplifying
>> `pure` instead.
>>
>> * There are many legitimate reasons to want impure code act as pure.
>> * There is no easy recourse as there is for @trusted. All approaches
>> are crazily convoluted.
>
> There are ways to do it that are in use in Phobos. It involves doing an
> unsafe cast.
Problem is there's a lot more work than trusted casts.
> 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".
> I'm
> uncomfortable making it too easy to defeat the semantics of pure.
This is a misunderstanding. That wasn't asked for.
You transferred your answer to the @trusted blocks discussion to a
different question.
More information about the Digitalmars-d
mailing list