[SO] Modifing local class instance in pure function
    Jesse Phillips 
    myselfhere at mailinator.com
       
    Wed Jun 17 13:34:30 PDT 2009
    
    
  
http://stackoverflow.com/questions/1008803/how-to-use-pure-in-d-2-0
class TestPure
{
string[] msg;
void addMsg( string s )
{
       msg ~= s;
   }
};
pure TestPure run2()
{
   TestPure t = new TestPure();
   t.addMsg("Test");
   t.addMsg("this.");
   return t;
}
This doesn't work and the answer from CyberShodow is that you could thread inside the pure function modifying the class value at the same time. Isn't that still an issue if TestPure was change to an int?
    
    
More information about the Digitalmars-d-learn
mailing list