Annotation for asynchronous functions



The gobject-introspection bugs were migrated from Bugzilla to GitLab today so I got a reminder of everything that I was subscribed to.

There are a couple of proposals for annotations I'd like to discuss on the mailing list. I'm not necessarily planning to work on them, but I'd like to get the discussion out of the way so that someone can easily pick them up. Hence this mail and the following ones.

Annotation for asynchronous functions: https://gitlab.gnome.org/GNOME/gobject-introspection/issues/28

tl;dr: Add an (async-finish) annotation to the async function, so that bindings can determine the finish function given the async function. This would become an async-finish attribute in the GIR.

/**
 * foo_bar_decide_async: (async-finish foo_bar_decide_finish):
 * @self: a #FooBar
 * @blah: a #FooBlah
 * @cancellable: (nullable): a #GCancellable
 * @callback: a #GAsyncResultCallback
 * @data: data to pass to @callback
...

Additionally there seems to be consensus around using the same heuristic that Vala currently uses, to determine this information in g-ir-scanner if no async-finish annotation is given.

There are a few functions which would need the annotation anyway, such as g_file_replace_contents_bytes_async() / g_file_replace_contents_finish().

Any comments?

(I have a GSoC proposal out for this issue and its follow-up work in GJS, by the way.)

Regards,
Philip C


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]