assemblyscript icon indicating copy to clipboard operation
assemblyscript copied to clipboard

Extern classes experiment

Open dcodeIO opened this issue 5 years ago • 1 comments

As a follow-up to today's meeting discussion about bindings, here's a little mad science binding AssemblyScript classes to externref objects.

The interesting parts are

  • loader.bind to make useful imports of an external class
  • std/assembly/bindings/DOM declaring the imports
  • tests/compiler/bindings/dom consuming the imports

This is far from perfect of course, like we are missing function overloading to describe multiple valid signatures, but here's where things become interesting.

Note that playing with the test requires ASC_FEATURES=* in the environment to enable all the things incl. reference-types.

cc @battlelinegames

  • [x] I've read the contributing guidelines

dcodeIO avatar Aug 13 '20 06:08 dcodeIO

Tests are failing because of a renaming conflict between the --experimental-wasm-reftypes and --experimental-wasm-anyref flags. Afaik current node uses the latter still, while canary switched to the former.

dcodeIO avatar Aug 13 '20 06:08 dcodeIO