Hi all,

I thought that numeric and string variable values are copied directly in 
a variable assignment and not by reference.
But in Jmol 14.3.13_2015_04_01 this doesn't seem to be true.

In the following example only the string variable value seems to be 
copied directly, not the value from the numeric variable:

----- Example --------
function referenceTest() {
   var testHash1  = {};
   var testHash2  = {};
   for (var i=1; i<3; i++) {
     testHash1[i] = {"i": i};
     var stringI = "val" + i;
     testHash2[i] = {"stringI": stringI};
   }
   print testHash1;
   print testHash2;
}
referenceTest;

----- Example Output -----
{
   1  :
   {
     i  :  3
    }
   2  :
   {
     i  :  3
    }
  }
{
   1  :
   {
     stringI  :  "val1"
    }
   2  :
   {
     stringI  :  "val2"
    }
  }

--------------------------

Q: Is this behavior intended or a bug?

Q: If it is intended, how can I get the actual numeric value into the hash?

Regards,
Rolf
-- 

Rolf Huehne
Postdoc

Leibniz Institute for Age Research - Fritz Lipmann Institute (FLI)
Beutenbergstrasse 11
07745 Jena, Germany

Phone:   +49 3641 65 6205
Fax:     +49 3641 65 6210
E-Mail:  rhue...@fli-leibniz.de
Website: http://www.fli-leibniz.de

           Scientific Director: Prof. Dr. K. Lenhard Rudolph
        Head of Administration: Dr. Daniele Barthel
Chairman of Board of Trustees: Dennys Klein

VAT No: DE 153 925 464
Register of Associations: No. 230296, Amtsgericht Jena
Tax Number: 162/141/08228


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to