GSOC Linker project

Artur Skawina art.08.09 at gmail.com
Mon May 7 04:47:47 PDT 2012


On 05/07/12 13:21, Steven Schveighoffer wrote:
> On Fri, 04 May 2012 20:30:05 -0400, Alex Rønne Petersen <xtzgzorex at gmail.com> wrote:
> 
>> Purity inference won't happen either way. Purity is part of your API and also meant to help you reason about your code. If the compiler just infers purity in a function and you later change the implementation so it's no longer pure, you break your users' code. Also, purity would no longer help you reason about your code if it's not explicit.
> 
> It can be pure for the purposes of optimization without affecting code whatsoever.  Inferred purity can be marked separately from explicit purity, and explicitly pure functions would not be allowed to call implicitly pure functions.

In WPO mode - it doesn't matter - it's just another internal compiler optimization.
Otherwise in general it can't be done - a change to the function definition would
change its signature - which means that all callers need to be recompiled.
So at best only the intra-module calls can be affected, when the compiler knows that
the caller will always be generated together with the callee. And the latter has to
be assumed impure if it's not private, for the same reasons.

artur


More information about the Digitalmars-d mailing list