cosmos72 / gomacro

Interactive Go interpreter and debugger with REPL, Eval, generics and Lisp-like macros

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wasm support.

Splizard opened this issue · comments

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

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