-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Cannot implement vfunc Gtk::Widget#do_measure
#32
Comments
We need to think how to "crystallize" this API, maybe letting The signature would be: I would not like to expose pointers in the API Or... we could let the signature return a NamedTuple:
The signature is longer and uglier, but less error prone to use in these cases of many out parameters. There's also the alternative of mix between two... if there's just 2 out parameters, the return type is a tuple, starting from 3 parameters, a named tuple. I tempted to choose that named tuple approach, despite of long to type it's safer... and BTW the user doesn't need to type the return type restriction in the method declaration. |
Often, it is allowed to set the pointers of the out parameters to NULL. In this case, the caller does not want a value. This is not really possible to communicate with Tuples. Maybe we can create an |
The Maybe we could do both approaches:
As their signature are different, they can have the same name, nowadays something similar is done when the method receives an array, there's a method that receives the array and another one that receives a variable number of arguments doing a splat. I'm going to work on this soon, since it become a blocker for my app due to some Pango functions that return multiple items. |
I need to never do any promises about what I'm going to fix/implement, since it depends on a combination of free time, mood and necessity, all 3 are not always present.
It is, however you will need to write some nils, however I think for simplicity this will end up being implemented (some day) only as named tuples return values: class FooWidget < Gtk::Widget
@[GObject::Virtual]
def measure(orientation, size)
{minimum: 10,
natural: 100,
minimum_baseline: 10,
natural_baseline: 10}
end
end |
I was implementing the
This |
Trying to implement the vfunc
measure
results in a compile-time error:I think this is because the last four arguments are of type
Int32*
as four Int32 should be returned using pointers.The text was updated successfully, but these errors were encountered: