Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extern classes experiment #1435

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Extern classes experiment #1435

wants to merge 3 commits into from

Conversation

dcodeIO
Copy link
Member

@dcodeIO dcodeIO commented Aug 13, 2020

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

  • I've read the contributing guidelines

@dcodeIO
Copy link
Member Author

dcodeIO commented Aug 13, 2020

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.

@@ -0,0 +1,171 @@
@extern
export declare class Object {
Copy link
Member

@MaxGraey MaxGraey Aug 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about move Object, String, Array and etc to bindings/JS namespace instead bindings/DOM? But rest of WebAPI objects (HTMLCanvasElement, CanvasRenderingContext2D, ...) keep here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants