Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

BigInt parameters for the JS API? #68

@bvisness

Description

@bvisness

As I finalize our implementation of table64, I'd like some clarity on the JS API. Some previous comments (e.g. #46 (comment), #46 (comment)) have suggested that .get, .set should accept both number and BigInt for their indices.

However, I'd like to clarify a couple things:

  1. i64 params must be BigInt (per ToWebAssemblyValue), so should BigInt be required for Table methods as well?
  2. What should Table.grow take? Memory.grow currently takes a number, even for memory64, despite memory.grow taking an i64. Perhaps this is just because the param is in units of pages? (But, if custom page sizes are coming down the pipe, this reasoning won't hold up for long.)

My suggestion would be for all of Table.get, Table.set, Table.grow, and Memory.grow to require BigInt when the index (address 🙂) type is i64. This is consistent with ToWebAssemblyValue(v, i64), and therefore consistent with the core wasm versions of these instructions.

Altering Memory.grow should also be backwards-compatible at this stage since memory32 is unaffected - although it may cause slight difficulty for toolchains in practice. Worth it imo (but I am not a toolchain author).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions