Memory allocation purity
    via Digitalmars-d 
    digitalmars-d at puremagic.com
       
    Sun May 18 23:05:26 PDT 2014
    
    
  
On Monday, 19 May 2014 at 05:39:49 UTC, Jonathan M Davis via 
Digitalmars-d wrote:
> 1. it makes it easier to reason about code, because it 
> guarantees that the
> function didn't access any global or static variables.
It can, through the parameters, like an array of pointers. And 
avoiding IO is not sufficient to mark 90% of my code as weakly 
pure.
> 2. it allows us to implicitly convert to different levels of 
> mutability for
> the return type of pure functions where the compiler can 
> guarantee that the
> return value was allocated within the function.
But if you can have a struct/pointer as a parameter then you can 
clearly return objects not allocated in the function?
    
    
More information about the Digitalmars-d
mailing list