On Fri, 2018-02-09 at 07:25 +0000, philip chimento gmail com wrote:
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.
Yeah, that seems reasonable.
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’d be in favour of Sebastian’s additional suggestion that we have a (sync-func FUNC) annotation which can be used to link the async and sync methods together. That would definitely be useful data to have. The heuristic to use here would be: • If the async method name ends in ‘_async’, the sync method name doesn’t have the prefix. • If the async method name doesn’t end in ‘_async’, the sync method name ends in ‘_sync’. • In both cases, - the methods must be on the same object, - a ‘_finish’ method must be available (either found by heuristic or by annotation), - the sync method must have the same return type as the _finish method, - the sync and async methods must have the same set of in parameters, ignoring the source object, GCancellable, GError, GAsyncReadyCallback and gpointer user_data (this one may be too hard to test reliably), and - the sync and finish methods must have the same set of out parameters. Cheers, Other Philip
Attachment:
signature.asc
Description: This is a digitally signed message part