-
Notifications
You must be signed in to change notification settings - Fork 286
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
Experimental version of API that replaces Handle<'a, V>
with &V
#347
Conversation
🎉 🎉 🎉 Awesome work Dave! |
Looks like something is wrong specifically with Node 6. Gotta go to bed but I'll investigate that next. |
FYI, Node 6 is end of life in April. |
Ugh, and now I can't even build it on my mac to investigate, because Node 6 has been left in an uncompilable state on macOS Mojave. |
OK but I can still build on Linux. Investigating… |
OK I believe this is the issue: DefinitelyTyped/DefinitelyTyped#32897 — I'm talking with the handlebars maintainers and I'll track their fix as it lands. |
…`JsUndefined::new_thin()` and `cx.undefined_thin()`.
…orking. Still a good amount of stubbed code left to finish...
- Move `build` and `build_infallible` into `cx.new()` and `cx.new_infallible()`, respectively
- runtime API consistency improvements - eliminate HandleArena - build/build_infallible -> ContextInternal::new/new_infallible, and they abstract the extraction of the raw Isolate - abstract away ContextInternal::alloc_persistent into the internals of new/new_infallible - add ContextInternal::new_opt for string construction that can fail without throwing a JS exception - execute_scoped - uncomment cx.empty_array - rename persistent_arena to handles
- eliminated all HandleScopes - changed classes to use Persistents
I merged #396 to fix the typescript issue, and I'm rebasing and trying again… |
Handle<'a, V>
with &V
Handle<'a, V>
with &V
@kjvalencik This PR is ready for experimentation! If you have any time and are still interested, it'd be super interesting to see an experiment or two with real code, both for comparing readability and to ensure there aren't noticeable performance issues. |
@dherman Yes, I can do that. I'll take notes along the way similar to what I did for the |
This is out of date, and @kjvalencik's experience experimenting with this change was pretty negative. I would love to know more about it at some point, but this isn't very high priority right now so I'm going to close the PR. We can always look at it for reference in future if we're interested in reviving the idea. |
Unfortunately, I deleted the branch that tested this API. If I recall correctly, this change forced users to define lifetimes in many places that it was previously not necessary. It made it very difficult for a new Rust user to try out Neon without immediately being thrown in the deep end. |
This experimental PR gets rid of the somewhat unpleasant
Handle<'a, V>
smart pointer type and replaces it with a simple&'a V
. Every context carries an internal arena for allocating handles so that the APIs can return references to those arena-allocated handles.As a simple example: