JS backend issues #22923
-
First, congratulations to the team: Felipe, spytheman, Jalon, Alex, yuyi and many others I can't remember and to the issue reporters. I have been testing graphical apps in V and found details but I think they are more difficult to report, demonstrate, test and fix... than those of C backend. In example `examples/js_dom_draw/draw.js.v this part of code works ok: clear_btn := document.getElementById('clearButton'.str)?
clear_btn.addEventListener('click'.str, fn [mut state, canvas] (_ JS.Event) {
state.ctx.clearRect(0, 0, canvas.width, canvas.height)
}, JS.EventListenerOptions{}) But if we try to unwrap the Option with an if clear_btn := document.getElementById('clearButton'.str) {
clear_btn.addEventListener('click'.str, fn [mut state, canvas] (_ JS.Event) {
state.ctx.clearRect(0, 0, canvas.width, canvas.height)
}, JS.EventListenerOptions{})
} The browser which runs the JS code notifies the problem.
At by inspecting the generated code we found next line
Questions
Again, thanks to everyone for the such a great job. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
V is maintained mainly by volunteers. To see work done on the JS backend would require having someone volunteer to work on the issues, and knows JS well enough to translate the V AST into JS code for output.
The intent was always that the native backend would become the default, with C being an option - same as the JS, Go, WASM, etc. backends - if it was ever developed enough to handle being the default. This would give V several advantages, such as not needing any C compiler installed on the system for it to work, etc. However, though we have had a few people who know x86_64/arm64 well enough to work on the native backend, none have stuck around long enough to complete it. Basically, the same is true for the other backends, including JS. |
Beta Was this translation helpful? Give feedback.
V is maintained mainly by volunteers. To see work done on the JS backend would require having someone volunteer to work on the issues, and knows JS well enough to translate the V AST into JS code for output.