Assemblyscript: Think about passing I64s to/from WASM as BigInts

Created on 22 May 2018  路  4Comments  路  Source: AssemblyScript/assemblyscript

As of https://github.com/AssemblyScript/assemblyscript/pull/111 it appears that I64s will be able to cross the WASM<->JS boundary at some point as BigInts, thus enabling support for long integers in both the assembly and portable as well as generated typescript definitions. One not so obvious prequesite here might be to handle these in (i64-to-i32-lowering) asm.js output as well somehow.

enhancement

Most helpful comment

BigInt is now in Chrome, Firefox (behind experimental flag), and NodeJS.

All 4 comments

BigInt is now in Chrome, Firefox (behind experimental flag), and NodeJS.

Would love to see 1234n syntax and BigInt type supported in assemblyscript, even if it's just i64 under the hood for now.

BigInt is definitely make sense only for arbitrary precision (actually any large numbers). In other case it will confuse folks

The loader now has BigInt64Array etc. support for what is an Int64Array in AS, and passing i64 <-> BigInt via exports and imports can be achieved by enabling --experimental-wasm-bigint in V8 for example with no further work necessary on our end. As such I consider "passing I64 to/from WASM" resolved, even though we don't have a BigInt class on the AS side yet, which would be a different enhancement to make.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jarble picture jarble  路  3Comments

kungfooman picture kungfooman  路  5Comments

drachehavoc picture drachehavoc  路  6Comments

torch2424 picture torch2424  路  5Comments

kyegupov picture kyegupov  路  3Comments