Hello,

These two snippets:
   for each (var i in Iterator(aJavaMap.entrySet)) print(i);
and:
   for (var i in Iterator(aJavaMap.entrySet)) print(i);
print the same results.

But when I try to destructure into key and value:
   for each (var {key: k, value: v} in Iterator(aJavaMap.entrySet)) 
{print(k); print(v)}
works but:
   for (var {key: k, value: v} in Iterator(aJavaMap.entrySet)) 
{print(k); print(v)}
fails with:
> Left hand side of for..in loop must be an array of length 2 to accept 
> key/value pair.

Ok, it makes sense but I find it somewhat inconsistent: wouldn't it be 
better to make
   for (var i in Iterator(aJavaMap.entrySet)) print(i);
to return a synthetic counter or to throw an exception?

Christophe Grand
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to