Open
Description
There is 2 types of JS Array:
Array
which is just an object list of heterogeneous types with some additional methodsTypedArray
subclasses for numerical values (Int<x>Array
,Uint<x>Array
,Float<x>Array
,BigInt<x>Array
andBigUint<x>Array
)
It's not easy to translate those to zig native types (eg. slice, tuple) as:
- we don't know the shape and the length for
Array
- we do know the type for
TypedArray
but not all native types have a corresponding JS typed array, eg. we will have to forbid[]bool
or[]<UserType>
as they don't have aTypedArray
counterpart
As they are JS native types, Array
and TypedArray
exists in the JS engine native API (eg. v8.Array), with all their public properties and methods like Length()
.
So maybe the more logical solution is just to expose those types, ie. define a jsruntime.Array
type that will use underneath v8.Array
(or quickjs.Array
).