Re: RFC: GSound, a GObject library for playing system sounds

On Fri, Nov 14, 2014 at 5:45 AM, Tristan Van Berkom <tristan upstairslabs com> wrote:
On Fri, 2014-11-14 at 21:34 +0800, Tristan Brindle wrote:
> > On 14 Nov 2014, at 8:15 pm, Sébastien Wilmet <swilmet gnome org> wrote:
> >
> > On Fri, Nov 14, 2014 at 05:47:52PM +0800, Tristan Brindle wrote:
> >>
> >
> > With the name GSound I was worried that you reused the g_ namespace (for
> > GLib), but it's not the case, so it's fine.
> >
> > gsound_context_play_full()
> > gsound_context_play_full_finish()
> >
> > To follow the GIO convention for async operations, the first function
> > should be renamed as play_full_async(). So that in the future if you
> > want to create a sync version, you can name it play_full().
> >
> Thanks for the feedback :-)
> In this case the async call will always be preferred, so if I ever added a sync version then it would be
> gsound_context_play_full_sync()
> I think this is the style gdbus uses for example to emphasise that you *should* be using the async version, so I figured I’d copy it.

I think there is not strong consensus, or ample consistency in the
naming of sync/async methods (I certainly wish that all sync methods
ended in _sync() and async methods were left without suffixes, but I
don't see much consistency).

The consensus in GIO originally was the pattern mentioned originally, all async calls would be specifically noted. Then David Zeuthen introduced the async-by-default pattern with some drive mounting changes, and the rest is history.

IMO, consistency is the most valuable aspect of the API, as the flip flopping defeats intuition. So as long as the library is all one way or the other, I don't think it matters much.

FWIW, evolution-data-server does use the _sync() suffix for all sync
calls, and no suffix for ordinary async operation.


desktop-devel-list mailing list
desktop-devel-list gnome org

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