-
Notifications
You must be signed in to change notification settings - Fork 7
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
all: Rework evy-evaluation to be hoisted on main #65
Conversation
Fix erroneously overridden env object, completely this time. While we added the fix in 4d25139 we forgot to override the broken lines. oups.
Simplify go.env definition so that we don't repeat key:val where key and val are the same.
Remove lex and parse from wasm and frontend as these were only used in the early stages to debug code. The buttons for lex and parse had been hidden for a while - let's simplify and remove all bindings completely.
firebase-deployment: https://evy-lang--65-092fjtga.web.app (43ca51c) |
a2915d8
to
9819141
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM I think. Not a fan of the global source variables - wondering if they can be somehow hoisted into the wasm instance, but its fine to get going I think.
9819141
to
c09addf
Compare
954f24e
to
31593d2
Compare
Launch wasm from go `main()` rather than from go exported function `evaluate()`. It turns out that some things, such as time.Sleep and fmt.Sprintf only get properly intialised with the main function is the entry point to the wasm code, so let's fix this up. We cannot pass parameters to main() so we need JS to provide function to extract the evy source as string. Unfortunately we can't pass strings directly in wasm so we have write bytes to linear memory. This was fine when passing strings as function arguments, but when we want return values this falls apart as wasm can only provide a single return value. I attempted to make this single return value a pointer in memory where the first 4 bytes contain the length and the following bytes the contents of a string, but got lost with endian specs and other details. Instead JS provides the somewhat hacky functions `sourcePtr` and `sourceLength`, which are called separate from Go code and reassembled to a string.
31593d2
to
43ca51c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📗 LGTM
Rework evy-evaluation to be hoisted on main rather than the separately
exported
evaluate
function. Some things, such as time.Sleep andfmt.Sprintf only get properly initialised if the main*() function is
the entry point to the wasm code.
Additional, we had to solve to problem of having a JS function
returning a string in memory - we've done this in a hacky way by
returning Ptr and Length in separate function calls.
In preparation remove Lex and Parse button and wasm bindings.