Hi all,
in Jmol 14.3.14_2015.06.06 the case of hash keys of a parameter hash in
a function call is sometimes converted to lower case.
The conversion (at least) occurs if a variable with the same name as the
hash key exists, independent of the case composition of the variable
name. But only inside a function that calls the function, not if called
directly.
---- Examples --------------------------------------------------
function hashTest(parameterHash) {
show parameterHash;
}
function callHashTest1() {
var firstParam = "p1_b";
var secondparam = "p2_b";
print " --- Brackets 1a (direct) ------";
hashTest([firstParam: "p1_a", secondParam: "p2_a"]);
print "\n --- Brackets 1b (by variable) ------";
hashTest([firstParam: firstParam, secondParam: secondParam]);
print "\n --- Braces 1a (direct) ------";
hashTest({"firstParam": "p1_a", "secondParam": "p2_b"});
print "\n --- Braces 1b (by variable) ------";
hashTest({"firstParam": firstParam, "secondParam": secondParam});
}
function callHashTest2() {
print " --- Brackets 2a (direct) ------";
hashTest([firstParam: "p1_a", secondParam: "p2_a"]);
print "\n --- Braces 2a (direct) ------";
hashTest({"firstParam": "p1_a", "secondParam": "p2_b"});
}
print "===== Function call from function 1 ======";
callHashTest1;
print "\n===== Function call from function 2 ======";
callHashTest2;
print "\n===== Direct function call ======";
firstParam = "p1_b";
secondparam = "p2_b";
print " --- Brackets 3a (direct) ------";
hashTest([firstParam: "p1_a", secondParam: "p2_a"]);
print "\n --- Brackets 3b (by variable) ------";
hashTest([firstParam: firstParam, secondParam: secondParam]);
print "\n --- Braces 3a (direct) ------";
hashTest({"firstParam": "p1_a", "secondParam": "p2_b"});
print "\n --- Braces 3b (by variable) ------";
hashTest({"firstParam": firstParam, "secondParam": secondParam});
---- Example Output ---------------------------------------------
===== Function call from function 1 ======
--- Brackets 1a (direct) ------
parameterHash = { "firstparam":"p1_a","secondparam":"p2_a" }
--- Brackets 1b (by variable) ------
parameterHash = { "firstparam":"p1_b","secondparam":"p2_b" }
--- Braces 1a (direct) ------
parameterHash = { "firstParam":"p1_a","secondParam":"p2_b" }
--- Braces 1b (by variable) ------
parameterHash = { "firstParam":"p1_b","secondParam":"p2_b" }
===== Function call from function 2 ======
--- Brackets 2a (direct) ------
parameterHash = { "firstParam":"p1_a","secondParam":"p2_a" }
--- Braces 2a (direct) ------
parameterHash = { "firstParam":"p1_a","secondParam":"p2_b" }
===== Direct function call ======
--- Brackets 3a (direct) ------
parameterHash = { "firstParam":"p1_a","secondParam":"p2_a" }
--- Brackets 3b (by variable) ------
parameterHash = { "firstParam":"p1_b","secondParam":"p2_b" }
--- Braces 3a (direct) ------
parameterHash = { "firstParam":"p1_a","secondParam":"p2_b" }
--- Braces 3b (by variable) ------
parameterHash = { "firstParam":"p1_b","secondParam":"p2_b" }
-----------------------------------------------------------------
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: [email protected]
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
------------------------------------------------------------------------------
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users