Return type "(allow-none)" annotations?



Hi,

Using GIRepository, I find that g_callable_info_may_return_null always returns false for the Gtk repo. Looking at the GIR file, I can't see any instance of the corresponding attribute. However, clearly there are hundreds of functions that may return null! Am I missing something here? Does GIR provide another way to determine this information?

Looking at the sources for GTK+ 3.0.12, the only function I can find with the (allow-none) return attribute is the (internal) function
  _gtk_tree_menu_get_root

As of 3.2.3 the attribute is also present for the functions
  gtk_font_chooser_get_font
  gtk_font_chooser_get_font_desc

I note that ChangeLog.pre-git for gobject-introspection contains:

2005-05-13  Matthias Clasen  <...>

	...

	* src/generate.c (write_callable_info): Don't forget to
	write transfer and null-ok attributes for return types
	and parameters.

	* src/girepository.h:
	* src/ginfo.c (g_callable_info_may_return_null):
	New function to find out if a function may return NULL.

Various questions spring to mind:

  - Have the return type null-ok/allow-none attributes
    really been forgotten for so long or is there some
    reason behind their omission?

  - Is anyone currently working on adding them?  (Perhaps
    optimistic, but 3.2.3 was showing promising signs!)

  - Is it worth me adding them?  (Would the review effort
    be equal to the effort to add them though?)

I'm partly surprised that no language binding to date has required them.

Thanks for any feedback,

Phil


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