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

Implement This for JsBox<...>? #869

Open
ErichDonGubler opened this issue Mar 5, 2022 · 1 comment
Open

Implement This for JsBox<...>? #869

ErichDonGubler opened this issue Mar 5, 2022 · 1 comment

Comments

@ErichDonGubler
Copy link

ErichDonGubler commented Mar 5, 2022

JsBox<...> appears to implement Object, and Managed. Is there a reason that it doesn't also implement This also? The lack of This implementation currently makes it impossible to have a MethodContext<'_, JsBox<...>>, which is something that was previously possible with declare_type! { ... }.

@kjvalencik
Copy link
Member

There's no reason it couldn't but it would not provide value. declare_type is not implemented for the Node-API backend and will not be (it is not very ergonomic and is unsound when used with workers).

The current recommendation is to use JsBox and some glue code in JavaScript to create classes. See this example: https://github.com/neon-bindings/examples/blob/main/examples/async-sqlite/index.js

The goal is to addon classes later with a proc macro design.

neon-bindings/rfcs#43
#745

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

No branches or pull requests

2 participants