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

Re: "dselect" replacement team

Jason Gunthorpe wrote:
> I recommend the use of C++ simply because it would result in a much
> cleaner client side implementation, a reduced function C translation
> library could be added at some later date if it is really needed, in truth
> traditional C programers can realtively easially make use of a C++ class
> library without a very big learning curve.

This much is probably true.

> Of course I'd much rather write Object Oriented C++ with clear evidence of
> communication and control than write Object Oriented C with nothing but
> comments to act as a guide. (I've long since given up on procedural C)

You seem to be suffering from the delusion that C++ is an
object-oriented language.  It's not.  It's a _parody_ of an
object-oriented language.  The only object-oriented dialect of C is
Objective-C, a beautiful and elegant language nobody knows about except
NeXT programmers.  :(  Java might be interesting, but until the gcc
front-end which turns Java into native binaries appears, it's not
practical for this sort of thing.

All that said, however, writing the library in C++ is probably a good
idea.  Most C-centric programmers can pick up a C derived languge
easily.  I've learned a reasonable about of C++, although I barfed on
templates, a horrid hack to compensate for the fact that C++ is too
strongly typed.  It looks like a rejected idea from Ada.  (*ritual
gesture of warding off evil*)

> There is only one compelling reason to ever choose C, and this is if you
> do not know C++, or the people who are going to be using your code do not
> understand enough C++ to make sense of it. dpkg-lib is going to be simple
> enough C++ that nothing complex like virtual functions, iheritance and
> whatnot will be a major issue.

It's in vogue to bash procedural languages in these days of object hype,
but remember that object-orientation is just a programming style to be
applied where it works.  Every so often somebody comes up with the
brilliant idea of re-writing the Linux kernel in C++, to make it object
oriented, and is greeted by a loud chorus of "WHAT ARE YOU, NUTS?!?!?" 
Correctly so.  The linux kernel obtains a necessarly level of
object-orientation by judicious use of structures and pointers. 
Anything beyond that would just cause bloat and slowdown.


Reply to: