If you could make any changes to D, what would they look like?

max haughton maxhaton at gmail.com
Thu Oct 28 23:38:05 UTC 2021

On Thursday, 28 October 2021 at 23:05:04 UTC, Dukc wrote:
> On Thursday, 28 October 2021 at 21:48:09 UTC, max haughton 
> wrote:
>>> No that's slightly different. The linked issue deals with 
>>> strongly `pure` functions. I'm dreaming about letting the 
>>> compiler to optimise based on weak `pure` too - not currently 
>>> allowed if I read the spec right, but could be without this 
>>> issue (I think?).
>> Is this worth caring about?
> You decide. Without that, the weak `pure` can still be used 
> inside strongly pure functions, but is otherwise useless for 
> optimisation.
>> Do the backend a that actually matter not already perform this 
>> analysis as part of their IPA?
> If the function body is available and not too complicated, 
> probably. But with `pure` it's possible for a compiler to 
> optimise based on the signature alone.
> I don't personally care that much about having a 
> super-optimising compiler, but I still wish that our attributes 
> provide as much info as possible for any analysis program.

I still think this analysis is going to be done anyway by either 
GCC or LLVM. Also, is elision even valid in the general case, 
what if the function is weak. It can't be elided until link-time 
in some rare but not impossible circumstances.

More information about the Digitalmars-d mailing list