Re: Passing Java lists into JS

2014-11-27 Thread Attila Szegedi
I'd still refrain from automatically wrapping into an Array anything that implements a List interface because it might be implementing other interfaces too, and it might be passed back to Java and have semantics dependent on referential identity. There's also the issue that currently, we don't

Re: Passing Java lists into JS

2014-11-27 Thread A. Sundararajan
* On backed storage being non-array. jdk.nashorn.internal.runtime.arrays.ArrayData is "backing store" impl for array storage - apart from Java array based impls there is on based on nio ByteBuffer. Not sure how feasible is to have one based on List. Also, even with one based on List, it woul

Re: Passing Java lists into JS

2014-11-27 Thread Tim Fox
On 27/11/14 10:33, Attila Szegedi wrote: Nashorn explicitly allows [] operator on java lists and it also supports for…in on them. ".length" is also supported since 8u20, see . We indeed don't implicitly convert Lists into JS Array objects in Na

Re: Passing Java lists into JS

2014-11-27 Thread A. Sundararajan
List return values from Java are not converted to JS Arrays. But usual 'indexing' to get elements and ".length" to get size work (later added in 8u20 or 8u40 - need to check). And usual for..in and for..each..in (extension) work on Lists. Rational is to avoid wrapping Lists as another Script ob

Re: Passing Java lists into JS

2014-11-27 Thread Attila Szegedi
Nashorn explicitly allows [] operator on java lists and it also supports for…in on them. ".length" is also supported since 8u20, see . We indeed don't implicitly convert Lists into JS Array objects in Nashorn. The reason is that JS Array has a J