Client API pedantism

Thomas Voß thomas.voss at canonical.com
Mon Apr 8 06:32:38 UTC 2013


On 08.04.2013 07:30, Robert Ancell wrote:
> On 08/04/13 15:16, Daniel van Vugt wrote:
>> Hi all...
>>
>> It's nice that the Mir client API uses a common pattern that many C
>> developers will find familiar:
>>
>>   namespace_class_method(NamespaceClass *x, ...);
>>
>> I like it. Just be careful about breaking the pattern. For example:
>>
>>   mir_surface_create(MirConnection *connection, ...);
>>
>> Arguably, this should instead be something like:
>>
>>   mir_connection_createsurface(MirConnection *connection, ...);
>>
>> Because you're not operating on a surface (mir_surface_whatever) until
>> the surface exists.
>>
>> I'm not sure I'd go as far as proposing a change to the above function
>> any time soon. But it's worth keeping consistency in mind for future
>> API additions.
>>
>> - Daniel
>>
> 
> I agree we should be using namespace_class_method for names. Another one
> that breaks this is:
> 
> int mir_debug_surface_id(MirSurface *surface);
> 
> Which I would expect to be:
> 
> int mir_surface_get_debug_id(MirSurface *surface);
> 
> I say it's not something that needs to fixed immediately, but can be
> migrated over before 1.0.
> 

Agreed, and Daniel's remark is very valid. Do we have bugs filed for this?

Thomas

> --Robert
> 




More information about the Mir-devel mailing list