A_GIMMEBACK routine appears in quickref menu

I’ve implemented a method that should only ever be called by other objects behind the scenes that has a return value. The method is declared as taking A_GIMMEBACK. Everything works, but the method turns up in the quickref, which I’d rather it didn’t. Have I done this the right way, or is there a better one, or should I just live with it?

You could just use A_CANT, and call using object_method() instead of object_method_typed(). You’ll need to double the symbol arg in such a case, since object_method() pops the symbol and passes on any following arguments blindly.

This is a required signature for returning values to JS, Java, Lua, etc. via the language bindings.

In the case of calling such methods you would need to call it like this:

object_method_typed(x,gensym("foo"),argc, argv, &rv);

Or as untyped with:

object_method(x,gensym("foo"),gensym("foo",argc,argv,&rv));

Note the double symbol since object_method does not pass the symbolic message selector on to the method it is calling. It pushes anything following it onto the stack, so places which expect to receive the symbolic message selector such as A_GIMME, or A_GIMMEBACK functions require supplying the symbolic message selector twice. The reason for this can be demonstrated by the following untyped method calling of a function which, if typed, would have the signature A_LONG:

object_method(x,gensym("bar"),27);

would be used to call the following function with an argument of 27, (no symbol)

mybar(t_object *x, long x);

I know that this might be a little confusing, and I don’t have time to discuss in more detail, but I hope this helps. A related thread is here:

OK – got it – not confusing at all – thanks Joshua. Now I understand what is going on and looks like I can actually define the function:

void *ibuffer_valid (t_ibuffer *x)
{
return (void *) &x->valid;
}

I think I originally tried implementing as a CANT but couldn’t get it to work for some reason I forget so tried A_GIMMEBACK. Now I will know what to do in future in either case. Thanks again for your time.