Hello,
        
        Imagine that I have a data structure called DS1 declared at some
        place Place(0). Imagine that there is also a data structure
        called DS2 at Place(1). I have global references to these
        data-structures called GDS1 and GDS2 pointing to DS1 and DS2
        respectively.
        
        Now, I have a third place Place(2) where I have these global
        references and I want to do some computations.
        
        I know I can write this:
        
        at(GDS1){
         ds1 : DS1 = GDS1(); //get the object from reference at
         references place.
         val ds2 : DS2 = method1(ds1); //do something convoluted on the 
data-structure
         (this will make large copy of "this" class)
         at(GDS2){
          GDS2() = ds2; //set ds2 at GDS2's home.
         }
        }
        
        and it works. But, it makes a number of copies of "this". I mark
        the non required fields transient and hope that everything is
        well and good.
        
        I want to know can I do something like this:
        
        var ds11 : DS1 = null;
        at(GDS1){
         ds11 = GDS1().copy(); //this makes a deep copy of the required
        //data structure
        }
        //And then freely use ds11 here as I want (currently according
        to semantics once I am out of the scope of GDS1, ds11 is null
        again). The essential thing is the copy construct, which lets me
        make a deep copy. Java gives me at least the clone call, which
        lets me make shallow copies, which suffice most of the time. How
        can I achieve this in X10.

-- 
Regards,

Avinash Malik

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to