Skip to content
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

[WIP] - Extra features for the Node.js FFI support (such as closures) #39

Merged
merged 2 commits into from
Mar 23, 2021

Conversation

danielhenrymantilla
Copy link
Collaborator

Branch to experiment with changes; can only be merged to #32 once that is deemed not to break the ditto codebase.

@danielhenrymantilla
Copy link
Collaborator Author

No hurries or anything, @hamchapman, but just to get somebody to somewhat review what is done here with the Closures, I wouldn't mind your skimming over the current implementation to see what you think 🙂

@danielhenrymantilla danielhenrymantilla marked this pull request as ready for review March 17, 2021 18:57
@danielhenrymantilla danielhenrymantilla force-pushed the ditto-node-js-feature-closures branch 2 times, most recently from 44cb08e to b48cb9d Compare March 17, 2021 19:03
Copy link
Member

@hamchapman hamchapman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice 🙌 Awesome work getting this to play nicely 👍

Cargo.toml Outdated Show resolved Hide resolved
src/node_js/closures.rs Outdated Show resolved Hide resolved
src/node_js/closures.rs Outdated Show resolved Hide resolved
@danielhenrymantilla danielhenrymantilla marked this pull request as draft March 18, 2021 20:54
@danielhenrymantilla
Copy link
Collaborator Author

@hamchapman I have manually squash-merged this into #32, which is the "develop" / release branch currently used by ditto. I will keep this WIP branch for some other musings 😄

@danielhenrymantilla danielhenrymantilla marked this pull request as ready for review March 18, 2021 21:04
@danielhenrymantilla danielhenrymantilla marked this pull request as draft March 18, 2021 21:04
@danielhenrymantilla danielhenrymantilla force-pushed the ditto-node-js-feature-closures branch 2 times, most recently from 08cbb3e to 5c13b6f Compare March 21, 2021 18:06
@danielhenrymantilla
Copy link
Collaborator Author

@hamchapman could you skim over the last round of updates and improvements? Thanks 🙂

)>
>
= None.into()
;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind the "clarity" of this file, I have just used it to write potentially weird patterns that happen to cover / challenge most edge cases of the FFI.
In this instance, within this call_with_42 callback, I am testing the three main situations where a JsFunction may be called:

  • same-thread, original FFI-call,
  • background thread,
  • same-thread, follow-up FFI call (hence this thread_local)

@danielhenrymantilla danielhenrymantilla force-pushed the ditto-node-js-feature-closures branch from 94cfb47 to 7e5f2dc Compare March 22, 2021 22:33
@danielhenrymantilla danielhenrymantilla marked this pull request as ready for review March 23, 2021 00:10
Copy link
Member

@hamchapman hamchapman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Awesome work 👏

src/node_js/closures.rs Show resolved Hide resolved
src/node_js/closures.rs Show resolved Hide resolved
@danielhenrymantilla danielhenrymantilla merged commit f03eac8 into ditto-node-js Mar 23, 2021
@danielhenrymantilla danielhenrymantilla deleted the ditto-node-js-feature-closures branch March 23, 2021 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants