Gc: Consider splitting out array types

Created on 22 Jan 2019  路  5Comments  路  Source: WebAssembly/gc

Arrays of numeric types which can be passed in from JavaScript to WebAssembly are a major feature request I hear from developers when I ask about using WebAssembly to optimize JavaScript programs. Without this, additional copying is needed to move the data into WebAssembly memory.

The array type aspects of this proposal seem much simpler than the rtt system. There is also an ongoing collaboration with TC39 to represent GC types as typed objects, led by @tschneidereit. This proposal will take some time to develop.

Would it make sense to consider shipping array types separately from the rest of this proposal?

Most helpful comment

I would prefer to keep array types together with struct types. The main reason is that we should ensure that there is absolutely no impedance mismatch between arrays of primitives on the one hand, and arrays of refs, and refs in general. I'm not sure we can guarantee that if we specify array types ahead of the rest.

All 5 comments

I would prefer to keep array types together with struct types. The main reason is that we should ensure that there is absolutely no impedance mismatch between arrays of primitives on the one hand, and arrays of refs, and refs in general. I'm not sure we can guarantee that if we specify array types ahead of the rest.

The array part is quite intertwined with the rest of the proposal. It also doesn't have a JS interop story without the Typed Object proposal, which GC types are supposed to map to (plain JS typed arrays are not sufficient to define array interop, AFAICS). It's not clear how to separate these things in a useful and forward compatible manner. (RTTs are a different, mostly independent axis.)

It also doesn't have a JS interop story without the Typed Object proposal, which GC types are supposed to map to (plain JS typed arrays are not sufficient to define array interop, AFAICS).

This was part of the story that I didn't understand. Any idea where I can read more details?

I'll have to defer to @tschneidereit on this one.

Not much progress has been made here, and it seems like in general there is opposition to splitting out array types. Closing, but feel free to reopen if there are any concerns.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tlively picture tlively  路  4Comments

tlively picture tlively  路  8Comments

jakobkummerow picture jakobkummerow  路  18Comments

fgmccabe picture fgmccabe  路  9Comments

binji picture binji  路  16Comments