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.

I looked at the "GTK+ Bindings" page, and found that there are at least 21
languages with bindings to GTK+.  I think this multi-computer-language support
is great -- GTK+ really _can_ claim that it supports many computer languages.

However, as noted by others, this whole "static string" issue is
not relevant to the vast majority of languages other than C.
If C is only 1 of 21 languages, but the function names are visible to all
all languages, it'd make sense if we try to make the names seem
"reasonable" to most/all languages (not just C).

In particular, as noted by Manuel M. T. Chakravarty:
> renaming functions is not attractive for a binding, because it means that
> it becomes more difficult to use the standard documentation for the binding.

The counter was posted:
>I agree this is a problem, but some documentation of the peek vs. get
>convention could partially mitigate it.

True, but since there's another approach that doesn't require
mitigation at all (specially-marked types), why not choose the approach
that eliminates what would at first _appear_ to be an inconsistency?

This clealy isn't a do-or-die issue, but using type information to indicate
this seems better, since GTK+ supports so many languages.


-- 

--- David A. Wheeler
    dwheeler@ida.org






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