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

Wasm support. #68

Open
Splizard opened this issue Aug 30, 2019 · 1 comment
Open

Wasm support. #68

Splizard opened this issue Aug 30, 2019 · 1 comment

Comments

@Splizard
Copy link

Would be nice to get Wasm support for embedded gomacro.
Currently gomacro requires gls which is not implemented for wasm.

Even after creating a dumy gls function, gomacro panics when run in the browser:

panic: runtime error: index out of range
wasm_exec.js:47 
wasm_exec.js:47 goroutine 1 [running]:
wasm_exec.js:47 github.com/cosmos72/gomacro/base/paths.init.ializers()
wasm_exec.js:47 /go/src/github.com/cosmos72/gomacro/base/paths/paths.go:75 +0x19
@cosmos72
Copy link
Owner

cosmos72 commented Aug 31, 2019

Wasm support would definitely be interesting :)
Gls is "goroutine local storage" and is needed by goroutines.

If I remember correctly, wasm does not (yet) have threads: if GOARCH=wasm does not have goroutines too, then a stub implementation of gls will suffice.

One thing I don't know is whether GOARCH=wasm allows unsafe.Pointer - gomacro uses it in several places, both as an optimization and to add some missing features to the reflect package

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

No branches or pull requests

2 participants