[vlc-devel] commit: New C++ binding for libvlc. ( R?mi Duraffort )

Hugo Beauzee-Luyssen beauze.h at gmail.com
Mon Jan 25 15:59:37 CET 2010

On Mon, Jan 25, 2010 at 3:49 PM,  <jpd at videolan.org> wrote:
> On Mon, Jan 25, 2010 at 03:25:41PM +0100, Hugo Beauzee-Luyssen wrote:
>> To avoid having a type* instance(); method and a type* m_instance
>> member in every class that binds a libvlc type, i'd recommand you to
>> use a template parent class such as this one :
>> http://www.vlmc.org/repositories/entry/vlmc/src/LibVLCpp/VLCpp.hpp
>> The cast operator may be a bit much, though it's quite handy as it
>> prevents you to have to call instance() in most cases.
> I thought this was about wrappers that are supposed to handle exactly
> that sort of thing and aren't supposed to export their internal
> instances, so why you'd mechanise something they're not supposed to do
> is something you'd perhaps best eludiate upon.
> One of the things you can do very well in C++ is obviating the need
> for exactly the kind of asserts you're adding there wholesale.
> Casting operators come with their own very special set of caveats.
>> The last remark kinda break the thread chronology, but please, no,
>> don't use overload to differenciate getters and setters.
> Explain then, and with something better than this troll:
>> The "let's use c++ features" argument is void, otherwise let's
>> overload "operator ,". I'm sure it can be used somehow.
> I suppose you'd prefer to argue "let's not use C++ features", which
> frankly does not make sense for creating "C++ bindings".
> Nice to see you recommending seriously tricky C++ features while at it.

C++ features are meant to improve code readability. Personnaly, when
i'm reading "time" and not "setTime" i think it's a getter.
Relying on a c++ feature to decide whether this method is a getter or
a setter seems wrong to me.
The seriously tricky c++ feature you're talking about are just here to
avoid calling getInstance every now and then, which (I think), improve
code readibility with c++ features, unlike having a getter/setter
As far as I'm concerned, a c++ feature used to avoid typing "get" and
making the code less obvious at the same time is a wrongly used c++

Hugo Beauzée-Luyssen

More information about the vlc-devel mailing list