Re: Consensus on getter conventions?



Oskar Liljeblad <osk@hem.passagen.se> wrote,

> The main issue as I see it is figuring out whether a function returns
> a static string or a dynamic. Why not just add a postfix '_s' to
> methods which return static strings? And if compatibility with old
> versions of GTK is to be kept, add a set of functions with '_d'
> postfix as well. In the end, all you need to achieve consistency
> is a set of #define's in the appropriate header files:
> 
>   #define gtk_accelerator_get_d		gtk_accelerator_get
>   #define gtk_arg_name_strip_type_s	gtk_arg_name_strip_type
>   #define gtk_clist_get_column_title_s	gtk_clist_get_column_title
>   #define gtk_args_collect_d		gtk_args_collect
>   #define gtk_entry_get_text_s		gtk_entry_get_text
> 
> (This along with a policy to recommend future functions that
> return gchar*, gchar**, GList* and others to end with either _d
> or _s.)

Pre-processor magic is bad for some language bindings - eg,
for the Haskell binding.

Manuel





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