You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we can only create function that can be coerced into a NativeFunction, this does not allow us to capture variables from a closure. And changing the function signature of NativeFunction to Box<dyn Fn> would be bad for performance reasons, since for every function now we have to allocate. Instead we would have another variant in Function enum Closure that would contain a Box<dyn Fn>
So I propose the following, we add separate functions for closures function creation.
let some_variable = ...context.register_global_closure("name",move |_, _, _| {Ok(some_variable)});
We would also add a way to create a closure with the FunctionBuilder
The text was updated successfully, but these errors were encountered:
Currently we can only create function that can be coerced into a
NativeFunction
, this does not allow us to capture variables from a closure. And changing the function signature ofNativeFunction
toBox<dyn Fn>
would be bad for performance reasons, since for every function now we have to allocate. Instead we would have another variant inFunction
enumClosure
that would contain aBox<dyn Fn>
So I propose the following, we add separate functions for closures function creation.
We would also add a way to create a closure with the
FunctionBuilder
The text was updated successfully, but these errors were encountered: