Re: Woo hoo ... a whole new set of compiler headaches!! - Mailing list pgsql-hackers
From | Dann Corbit |
---|---|
Subject | Re: Woo hoo ... a whole new set of compiler headaches!! |
Date | |
Msg-id | D425483C2C5C9F49B5B7A41F89441547055AEA@postal.corporate.connx.com Whole thread Raw |
List | pgsql-hackers |
> -----Original Message----- > From: pgsql-hackers-owner@postgresql.org [mailto:pgsql-hackers- > owner@postgresql.org] On Behalf Of Andrew Dunstan > Sent: Friday, April 22, 2005 10:46 AM > To: Dave Held > Cc: pgsql-hackers@postgresql.org > Subject: Re: [HACKERS] Woo hoo ... a whole new set of compiler headaches!! > > > > Dave Held wrote: > > >>-----Original Message----- > >>From: Alvaro Herrera [mailto:alvherre@dcc.uchile.cl] > >>Sent: Friday, April 22, 2005 12:06 PM > >>To: Tom Lane > >>Cc: Dave Held; pgsql-hackers@postgresql.org > >>Subject: Re: [HACKERS] Woo hoo ... a whole new set of compiler > >>headaches!! :) > >> > >>[...] > >>Why don't we rewrite Postgres in D? > >> > >>http://www.digitalmars.com/d/ > >> > >>:-D > >> > >> > > > >I see the smiley, but moving to C++ isn't just about switching > >to the latest fad language. > > > > No, it's about moving to the fad language about 2 generations back ... Language wars are about as much fun as operating system wars. C and C++ are both nice languages. > >First of all, you would literally > >have to rewrite it to use D. There would probably need to be > >very little work to make the Postgres codebase a conforming set > >of C++ programs (mostly renaming variables/types named 'class', > >'virtual', 'bool', etc.). Second, you can find a decent C++ > >compiler on virtually every platform that has a C compiler. > >Third, C++ offers real advantages in type safety, exception > >handling, resource management, and even performance. > > > > > > Unless you did a major rewrite it's hard to see any great advantages. > There are over 600,000 lines of code in Postgres by my rough count. The > potential rewrite effort is enormous. A thorough job would probably > consume a release cycle just on its own. You could use C++ as "a better C" with very little effort (but there are C++ keywords sprinkled here and there, so it would be a good month of work for somebody). > Also, "virtually every platform" isn't good enough - we have a number of > oddballs in our supported list, and it would have to include at least > those. There is a C++ compiler for everything you can think of and most things you can't think of. That's not really a problem. The real problem is that the development team is a team of C programmers, not C++ programmers. That is the reason that a change makes no sense at all. > >Even doing something as simple as writing a stored procedure > >in C is somewhat awkward because of all the boilerplate casting > >that must be done. I'm fairly certain that most of the macros > >in the stored procedure interface could go away if a C++ API > >were created. > > > > > > > > On the downside, some of us (including me) have much more experience in > and ease with writing C than C++. I could certainly do it - I write > plenty of Java, so OO isn't a closed book to me, far from it - but > ramping up in it would take me at least some effort. I bet I'm not alone > in that. This is the crux of the matter. You will certainly not be alone here. I (personally) prefer C++ to C, but I am comfortable in either language. However, if you have a team of 100 C programmers and a huge C project, it is a terrible mistake to ask them to use C++. > So this would not be cost-free - very far from it. Here, we clearly agree. As a project scales larger and larger the benefits of C++ loom greater and greater. When your project consists of millions of lines of code, then C++ is a much better choice. But I don't think PostgreSQL is going to scale to titanic size any time soon. If it were, I would suggest the conversion, no matter how painful. > cheers > > andrew > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq
pgsql-hackers by date: