What's the recommended way to check if a receiver is frozen? #311
tavianator
started this conversation in
General
Replies: 1 comment
-
You can either pass a Ruby object (so the parameter has a type of Looking at the PR, you would do like you have: [](Object wrapper)
{
...etc...
} Or lower level but avoids the Object wrapper: [](VALUE wrapper)
{
bool isFrozen = Rice::detail::protect(RB_OBJ_FROZEN, wrapper);
etc...
}, Arg("wrapper").setValue() Or: [](faiss::Index& self)
{
Data_Object<faiss::Index> wrapper(self);
...etc...
} Most of the time you would pass the C++ instance since you are probably calling a C++ method. But in your case you are calling a Ruby method. So the easiest is what you have done using |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In a
define_method()
callback, I want to check if the current object is frozen and avoid mutating it if so. In ankane/faiss-ruby#7, I came up withIs that the best way to do it? I tried
but it told me
Type is not defined with Rice: Rice::Data_Object<T>
.Beta Was this translation helpful? Give feedback.
All reactions