Summary: | [GTK] Confusing webkit_uri_scheme_request_finish_error() description | ||
---|---|---|---|
Product: | WebKit | Reporter: | Milan Crha <mcrha> |
Component: | WebKitGTK | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW --- | ||
Severity: | Normal | CC: | bugs-noreply, mcatanzaro, tpopela |
Priority: | P2 | ||
Version: | WebKit Local Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Description
Milan Crha
2017-01-27 02:47:10 PST
Hm, I agree that's kind of confusing for a C developer. Is it normal to use const to indicate transfer for GError parameters? The default annotation is transfer none, so it's unambiguous that all language bindings will maintain ownership and that your code should too, but I do understand why you expected it to be transfer full. I do not know how "normal" it is, I only try to keep APIs clean as much as possible, even in C, where the 'const' doesn't propagate to structure members. The hint with 'const' is like to mark a function 'const' in C++. Of course, there are some "issues" sometimes, when the corresponding API doesn't do the same, thus you can end with a silly typecast from const to non-const on an object where its get-function doesn't declare the object as const (and example can be a GSList/GList), though this is hidden to the caller. I'm fine if you do not want to change it to the 'const', just make it explicit in the documentation that the 'error' is not taken by the function. I consider confusing also [1], but maybe it's more about no explicit mention that the 'model' is referenced by the GtkTreeView. I understand that it's obvious when one knows about "default transfer method", but I confess I didn't know that. The closest to this webkit function might be [2], and even it's all deprecated, see the [3], which takes ownership of the 'error', but it's not properly annotated. GTask has this done properly, at least where I looked. [1] https://developer.gnome.org/gtk3/stable/GtkTreeView.html#gtk-tree-view-set-model [2] https://developer.gnome.org/gio/stable/GSimpleAsyncResult.html#g-simple-async-result-set-from-error [3] https://developer.gnome.org/gio/stable/GSimpleAsyncResult.html#g-simple-async-result-take-error I don't think it's desirable to mention in freeform documentation whether you have to free a variable when we already use a structured unambiguous annotation language to describe that. I agree that it is confusing if you're not familiar with the rules for defaults; I have to look them up semi-regularly myself. gtk-doc could be improved to explicitly indicate default annotations in order to avoid such confusion. As for const, we normally only use const to indicate ownership of char* strings. |