-
Notifications
You must be signed in to change notification settings - Fork 116
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
Add escape hatches to and from quickjs_wasm_sys
#610
Conversation
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.
For example, exotic object behaviors or QuickJS’s execution timeout.
Could you add a bit more detail about which APIs you'd like to see exposed? I'm not very familiar with "exotic object behaviours" for example.
Generally my stance is that quickjs_wasm_rs
should be as safe as it can be; I think this change is not changing that fundamental principle given that the safety around the methods is correctly annotated and we're not enforcing the usage of unsafe code, it's pretty much opt-in.
I'd be good though to have a list of features that you think we're missing in quickjs_wasm_rs
to be able to get get rid of these "escape hatches", so I'd appreciate if you could list those more concretely if you can.
I mean the short answer is: All QuickJS features 😅 Specifically for my explorations right now, I want to make use of the following QuickJS features:
In general I think these escape hatches are valuable and I don’t think they really pose a risk, but it’s totally your call. |
I think they are too IMO, and we should land this, given that we currently don't cover the entire surface area of the QuickJS API. But in the future, ideally we should support all the features in a safe way, hence my comment about not making any stability guarantees. And as mentioned above, these new methods are are not forcing anyone to use any unsafe operations.
Oh ok, that makes sense. This is probably going to be useful for #605 |
Would there be any value in putting the re-export of |
@jeffcharles I don’t think I have seen that be done before, but I like the suggestion. |
It seems like one of the bindings tests is failing, I think it could be related to the fix in |
Please update the CHANGELOG file for |
eccef4e
to
6ae8a32
Compare
@jeffcharles @saulecabrera I think this is good to go |
While
quickjs_wasm_rs
provides a much more ergonomic API, there are some features of QuickJS that are not exposed. For example, exotic object behaviors or QuickJS’s execution timeout.In the long-run, it would be great to have those in
quickjs_wasm_rs
, but in the meantime, it seems like a good idea regardless to me expose escape hatches to the low-level crate.Specifically:
wasm_quick_sys
module fromquickjs_wasm_rs
to avoid users having to add that crate themselves and potentially ending up with different version.u64
) into aJSValueRef
*mut JSContext
to aJSContextRef
and vice versa (in fact,*mut JSContext
was already exposed vianew_callback
, but hard to utilize without the other parts).