-
Notifications
You must be signed in to change notification settings - Fork 29
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
Re-implement boolean methods for custom type return #74
Comments
My thoughts quoted from the other thread on dealing with multiple types
|
If there is a noticeable performance hit on this it may be thrown out. |
Here's an idea on hacking performance and allowing error messages without using Structs but using callbacks. This example would allow us to work with anything and not just boolean values. This is not working code, just for example. def ruby_method_for_rust_implementation
vals = [nil, TypeError]
rust_thread_callback = RustThread.new { some rust callback thread pointer }
vals[0] = FFI_call_to_rust_method(parameters, rust_thread_callback)
# vals[0] or vals[1]
vals[rust_thread_callback.result]
end This is assuming that an array index is faster than an if condition. Also I'm a little unconformable with threads but as we're hopping between code bases it might be a good idea. It might be a very bad idea. |
I'll leave FasterPath methods with the same behavior. If new behavior is needed for monkey-patches or refinements we'll just write alternative methods for those. |
As per @dubek 's #67 suggestion I've researched and found in the FFI spec we can return custom types. See custom_type_spec.rb
We'll match the types to the way Ruby already does. This will be new behavior so we'll set this to release version 0.2.0
The text was updated successfully, but these errors were encountered: