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

Component Model & WIT IDL #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mizchi
Copy link

@mizchi mizchi commented Apr 17, 2024

I added component model support proposal.

It includes these proposals.

  • moonc generates component-model definitions
  • moonbit as wit guest
  • moonbit as wit host
  • wit file generation

It provides structured input/output with other languages.

Expected Usages

moonbit code

// lib.mbt
struct Point {
  x: Int
  y: Int
}
pub fn new_point(x: Int, y: Int) -> Point {
  Point::{x, y}
}

compile with jco (js host code generator)

$ moon build --target wasm-gc
$ npx jco transpile target/wasm-gc/release/build/mylib/mylib.wasm -o out

js host runner

const { new_point } = await import("./out/mylib.js");
console.log(new_point(3, 4)); // => {x: 3, y: 4}

@mizchi mizchi changed the title Add component-model proposal Component Model & WIT Apr 17, 2024
@mizchi mizchi changed the title Component Model & WIT Component Model & WIT IDL Apr 17, 2024
@mizchi
Copy link
Author

mizchi commented Apr 30, 2024

I found component model registry.

https://wa.dev/

If moonbit supports it, moonbit can use this ecosystem.

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.

1 participant