To help LDC/GDC
Manu
turkeyman at gmail.com
Tue Apr 9 00:41:43 PDT 2013
On 9 April 2013 01:40, Iain Buclaw <ibuclaw at ubuntu.com> wrote:
> On 8 April 2013 13:37, Manu <turkeyman at gmail.com> wrote:
>
>> Oh my god... ..... this is the most upsetting thing I've heard all day! :(
>> No really, I have been SOOOO excited for so long about this optimisation
>> potential in D!
>> There's gotta be something that can be done! >_<
>>
>> Does the front end know if the function actually DOES assign to any
>> state? The compiler could easily work that out, and in the event it doesn't
>> actually perform any such assignment, it could be marked pure for reals...
>>
>>
> Haven't looked, but it appears to have a general idea of this. D 'weak
> pure' and 'const pure' may update an internal state (had the latter bite me
> hard once). The only case where 'strong pure' might do this is by throwing
> an exception or an assert being thrown - this changes program state so
> can't be marked pure.
>
> So having identified this, we can safely say that functions could only be
> 'C pure' in the following case:
> - Compiled function is 'strong pure'
> - Compiled function is 'nothrow'
> - We are compiling in release mode.
>
> Only then we (the frontend) can safely say that 'this function has
> *absolutely* no side effects, so can be marked as pure'. Pure is never
> inferred.
>
How does one specify that in their code? Is 'strong pure' a keyword?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130409/f07bf82c/attachment.html>
More information about the Digitalmars-d
mailing list