Simplification of @trusted

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Jun 17 15:59:51 UTC 2021


On Thu, Jun 17, 2021 at 11:49:50AM -0400, Andrei Alexandrescu via Digitalmars-d 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.

What are the actual advantages of code being marked pure?  I'm all for
generalizing pure, but does it bring enough actual benefits to be worth
the effort?

I'm not talking about theoretical benefits, but actual benefits that the
compiler can actually make use of to emit better code.  I used to be a
big fan of pure, but in practice I've found that it doesn't make *that*
much of a difference in terms of codegen.  Maybe I'm missing something,
in which case I'd love to be enlightened.


T

-- 
Perhaps the most widespread illusion is that if we were in power we would behave very differently from those who now hold it---when, in truth, in order to get power we would have to become very much like them. -- Unknown


More information about the Digitalmars-d mailing list