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

Do we want to "own" the per-language WASM bindings/libs? #1771

Closed
joshgoebel opened this issue Jan 1, 2022 · 4 comments
Closed

Do we want to "own" the per-language WASM bindings/libs? #1771

joshgoebel opened this issue Jan 1, 2022 · 4 comments
Labels
lang: wasm WASM runtime related

Comments

@joshgoebel
Copy link
Collaborator

joshgoebel commented Jan 1, 2022

I've created the first, for Zig: https://github.com/joshgoebel/zig_bunnymark/blob/main/src/tic80.zig

Related: #1259

I imagine people will over time show up to write bindings for all the possible languages - look at the WASM-4 project for a list of what's already possible to compile to WASM pretty simply:

  • C/C++
  • D
  • C# (in progress)
  • Nelua
  • Go
  • Nim
  • Odin
  • Rust
  • Wat
  • Zig

WASM-4 "owns" the bindings (and build scripts) for each of these in it's own repo: https://github.com/aduros/wasm4/tree/main/cli/assets/templates

Although because of this they also kind of keep the API to "least common denominator" and the functions are all very C like - even when the languages might allow for much nicer APIs... Personally I'd hope we could be a little more flexible in that regard, but it does have concerns like documentation, etc... ie, the "original" API looks one way while the Zig or Odin API has "more niceness". Perhaps we could support both "raw" and nicer... Mostly I'm imagining useful "aliases" (such as noclip(), if we don't decide to add it more broadly) and named arguments:

// behind the scenes calls clip(-1,-1,-1,-1)
tic.noclip() 
// named arguments via a struct
tic.print("hello world", x, y, .{ scale: 3, fixed: false, smallfont: true, color: 4 })
@joshgoebel joshgoebel changed the title Do we want to own the per-language WASM bindings/libs? Do we want to "own" the per-language WASM bindings/libs? Jan 1, 2022
@joshgoebel joshgoebel added the lang: wasm WASM runtime related label Jan 1, 2022
@nesbox
Copy link
Owner

nesbox commented Jan 2, 2022

yes, we want it :)

@joshgoebel
Copy link
Collaborator Author

joshgoebel commented Jan 5, 2022

Where in the source tree should we place such things?

  • examples?
  • projects
  • templates?
  • examples/templates?
  • other??

@nesbox
Copy link
Owner

nesbox commented Jan 5, 2022

I'd select something like src/api/wasm/[c d go nim odin ...], but anyway it's your choice.

@joshgoebel
Copy link
Collaborator Author

Closing this as asked and answered and continuing with #1784.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang: wasm WASM runtime related
Projects
None yet
Development

No branches or pull requests

2 participants