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

boa: create a new DSL to generate JavaScript native extension #174

Open
yorkie opened this issue May 7, 2020 · 9 comments
Open

boa: create a new DSL to generate JavaScript native extension #174

yorkie opened this issue May 7, 2020 · 9 comments
Labels
boa Python related issues

Comments

@yorkie
Copy link
Member

yorkie commented May 7, 2020

As we have discussed at #172, to support boa is able to work on multiple platforms includes: N-API, WASM, Rust-based native extension for Deno.

@yjjnls has created a great project: https://github.com/yjjnls/napi-emscripten, which uses emscripten APIs as the DSL to generate N-API-based add-ons.

Boa is heavily based on N-API and it's mainly working for Node.js, therefore we are going to propose creating a N-API based DSL which could generate N-API, WASM, Deno extension and more.

Just feel free to comment anything if something wrong :)

@yorkie yorkie added community driven Community-driven issues boa Python related issues and removed community driven Community-driven issues labels May 7, 2020
@rickyes
Copy link
Contributor

rickyes commented Jun 4, 2020

Perhaps we could also use Emscripten APIs to generate WASM, as napi-emscripten does.

@yorkie
Copy link
Member Author

yorkie commented Jun 4, 2020

napi-emscripten seems using Emscripten API to generate the N-API.

@yorkie
Copy link
Member Author

yorkie commented Jun 4, 2020

Or we can just compile CPython to .wasm and call it in JavaScript.

@rickyes
Copy link
Contributor

rickyes commented Jun 4, 2020

IMO it works, given that WASM will be supported by more platforms in the future.

@yorkie
Copy link
Member Author

yorkie commented Jun 4, 2020

But we need to maintain the wasm-backend for boa/lib/*, how do you think about this implementation?

@rickyes
Copy link
Contributor

rickyes commented Jun 4, 2020

Maybe we need to maintain the various versions of boa/lib/*, which does not look too good.

@yorkie
Copy link
Member Author

yorkie commented Jun 4, 2020

Hmm, wasm-backend is for reducing the maintenance of that works IMHO.

@rickyes
Copy link
Contributor

rickyes commented Jun 4, 2020

I have some ideas and don't know if they'll work:

  1. compile Boa NAPI-addon as .wasm
  2. write DSL, generate extensions for each platforms based on existing boa/lib/* code

@yorkie
Copy link
Member Author

yorkie commented Jun 4, 2020

I'm -1 on the first one, that's really to implement because the N-API and WASM have some differences especially like Node.js Buffer, and write a DSL to generate extensions for platforms have the same implementation issue.

Why not try to maintain both the 2 backends(napi, wasm), that we can cover all possible issues one by one :)

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

No branches or pull requests

2 participants